OpenSCAD: fix error in workaroundforissue128needed with date formats (YYYYMMDD vs YYYY.MM.DD)

This happens when the git version of OpenSCAD is installed (which uses YYYYMMDD), instead of
the latest released version (from 2015, which uses YYYY.MM.DD).
This commit is contained in:
PoroCYon
2018-11-14 00:07:58 +01:00
parent a7094210f8
commit da09f7c3d9

View File

@@ -100,7 +100,11 @@ def workaroundforissue128needed():
see https://github.com/openscad/openscad/issues/128'''
vdate=getopenscadversion().split('-')[0]
vdate=vdate.split(' ')[2].split('.')
year,mon=int(vdate[0]),int(vdate[1])
if len(vdate) == 1: # probably YYYYMMDD format (i.e. git version)
vdate = vdate[0]
year, mon = int("".join(vdate[0:4])), int("".join(vdate[4:6]))
else: # YYYY.MM(.DD?) (latest release)
year,mon=int(vdate[0]),int(vdate[1])
return (year<2012 or (year==2012 and (mon <6 or (mon == 6 and \
(len(vdate)<3 or int(vdate[2]) <=23)))))
#ifdate=int(vdate[0])+(int(vdate[1])-1)/12.0