[GRASS-dev] [GRASS-SVN] r74358 - grass/trunk/lib/python/temporal

Hi,

it should really be >= 3 to avoid failing for future Python versions:

http://astrofrog.github.io/blog/2016/01/12/stop-writing-python-4-incompatible-code/

On Tue, Apr 9, 2019 at 5:07 AM <svn_grass@osgeo.org> wrote:

Author: sbl
Date: 2019-04-09 02:07:30 -0700 (Tue, 09 Apr 2019)
New Revision: 74358

Modified:
grass/trunk/lib/python/temporal/datetime_math.py
grass/trunk/lib/python/temporal/temporal_algebra.py
Log:
fix python version check

Modified: grass/trunk/lib/python/temporal/datetime_math.py

— grass/trunk/lib/python/temporal/datetime_math.py 2019-04-08 19:50:21 UTC (rev 74357)
+++ grass/trunk/lib/python/temporal/datetime_math.py 2019-04-09 09:07:30 UTC (rev 74358)
@@ -19,7 +19,7 @@
except:
has_dateutil = False

-if sys.version_info[0]:
+if sys.version_info[0] == 3:
unicode = str

DAY_IN_SECONDS = 86400

Modified: grass/trunk/lib/python/temporal/temporal_algebra.py

— grass/trunk/lib/python/temporal/temporal_algebra.py 2019-04-08 19:50:21 UTC (rev 74357)
+++ grass/trunk/lib/python/temporal/temporal_algebra.py 2019-04-09 09:07:30 UTC (rev 74358)
@@ -470,7 +470,7 @@
from .datetime_math import create_time_suffix
from .datetime_math import create_numeric_suffix

-if sys.version_info[0]:
+if sys.version_info[0] == 3:
unicode = str

##############################################################################


grass-commit mailing list
grass-commit@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-commit

Documented here:
https://trac.osgeo.org/grass/wiki/Python3Support#HowtowritePython3compatiblecode

On Tue, Apr 9, 2019 at 10:34 PM Anna Petrášová <kratochanna@gmail.com> wrote:

Hi,

it should really be >= 3 to avoid failing for future Python versions:

http://astrofrog.github.io/blog/2016/01/12/stop-writing-python-4-incompatible-code/

On Tue, Apr 9, 2019 at 5:07 AM <svn_grass@osgeo.org> wrote:

Author: sbl
Date: 2019-04-09 02:07:30 -0700 (Tue, 09 Apr 2019)
New Revision: 74358

Modified:
grass/trunk/lib/python/temporal/datetime_math.py
grass/trunk/lib/python/temporal/temporal_algebra.py
Log:
fix python version check

Modified: grass/trunk/lib/python/temporal/datetime_math.py

— grass/trunk/lib/python/temporal/datetime_math.py 2019-04-08 19:50:21 UTC (rev 74357)
+++ grass/trunk/lib/python/temporal/datetime_math.py 2019-04-09 09:07:30 UTC (rev 74358)
@@ -19,7 +19,7 @@
except:
has_dateutil = False

-if sys.version_info[0]:
+if sys.version_info[0] == 3:
unicode = str

DAY_IN_SECONDS = 86400

Modified: grass/trunk/lib/python/temporal/temporal_algebra.py

— grass/trunk/lib/python/temporal/temporal_algebra.py 2019-04-08 19:50:21 UTC (rev 74357)
+++ grass/trunk/lib/python/temporal/temporal_algebra.py 2019-04-09 09:07:30 UTC (rev 74358)
@@ -470,7 +470,7 @@
from .datetime_math import create_time_suffix
from .datetime_math import create_numeric_suffix

-if sys.version_info[0]:
+if sys.version_info[0] == 3:
unicode = str

##############################################################################


grass-commit mailing list
grass-commit@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-commit

Hi Anna and others,

Sorry for the mistake and thanks for the heads up! Good to see that experienced devs are on the watch!

Fixed in r74361

For the record, there is still:

lib/python/imaging/images2swf.py:87:PY3 = sys.version_info[0] == 3

which I did not touch.

Cheers

Stefan

···

Documented here:

https://trac.osgeo.org/grass/wiki/Python3Support#HowtowritePython3compatiblecode

On Tue, Apr 9, 2019 at 10:34 PM Anna Petrášová <kratochanna@gmail.com> wrote:

Hi,

it should really be >= 3 to avoid failing for future Python versions:

http://astrofrog.github.io/blog/2016/01/12/stop-writing-python-4-incompatible-code/

On Tue, Apr 9, 2019 at 5:07 AM <svn_grass@osgeo.org> wrote:

Author: sbl
Date: 2019-04-09 02:07:30 -0700 (Tue, 09 Apr 2019)
New Revision: 74358

Modified:
grass/trunk/lib/python/temporal/datetime_math.py
grass/trunk/lib/python/temporal/temporal_algebra.py
Log:
fix python version check

Modified: grass/trunk/lib/python/temporal/datetime_math.py

— grass/trunk/lib/python/temporal/datetime_math.py 2019-04-08 19:50:21 UTC (rev 74357)
+++ grass/trunk/lib/python/temporal/datetime_math.py 2019-04-09 09:07:30 UTC (rev 74358)
@@ -19,7 +19,7 @@
except:
has_dateutil = False

-if sys.version_info[0]:
+if sys.version_info[0] == 3:
unicode = str

DAY_IN_SECONDS = 86400

Modified: grass/trunk/lib/python/temporal/temporal_algebra.py

— grass/trunk/lib/python/temporal/temporal_algebra.py 2019-04-08 19:50:21 UTC (rev 74357)
+++ grass/trunk/lib/python/temporal/temporal_algebra.py 2019-04-09 09:07:30 UTC (rev 74358)
@@ -470,7 +470,7 @@
from .datetime_math import create_time_suffix
from .datetime_math import create_numeric_suffix

-if sys.version_info[0]:
+if sys.version_info[0] == 3:
unicode = str

##############################################################################


grass-commit mailing list
grass-commit@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-commit