[GRASS-SVN] r71438 - in grass/trunk/lib/python: ctypes/ctypesgencore/parser ctypes/ctypesgencore/printer pygrass/vector pygrass/vector/testsuite script temporal
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Aug 26 05:39:44 PDT 2017
Author: zarch
Date: 2017-08-26 05:39:44 -0700 (Sat, 26 Aug 2017)
New Revision: 71438
Modified:
grass/trunk/lib/python/ctypes/ctypesgencore/parser/cgrammar.py
grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py
grass/trunk/lib/python/ctypes/ctypesgencore/printer/preamble.py
grass/trunk/lib/python/pygrass/vector/table.py
grass/trunk/lib/python/pygrass/vector/testsuite/test_table.py
grass/trunk/lib/python/script/raster.py
grass/trunk/lib/python/script/task.py
grass/trunk/lib/python/temporal/core.py
Log:
python.builtins: remove wrong imports
Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/cgrammar.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/cgrammar.py 2017-08-25 20:39:57 UTC (rev 71437)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/cgrammar.py 2017-08-26 12:39:44 UTC (rev 71438)
@@ -10,12 +10,6 @@
* http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1124.pdf
'''
-try:
- from builtins import long
-except ImportError:
- # python3
- long = int
-
__docformat__ = 'restructuredtext'
import operator
@@ -31,6 +25,10 @@
from . import yacc
+if sys.version_info.major == 3:
+ long = int
+
+
tokens = (
'PP_DEFINE', 'PP_DEFINE_NAME', 'PP_DEFINE_MACRO_NAME', 'PP_MACRO_PARAM',
'PP_STRINGIFY', 'PP_IDENTIFIER_PASTE', 'PP_END_DEFINE',
Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py 2017-08-25 20:39:57 UTC (rev 71437)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py 2017-08-26 12:39:44 UTC (rev 71438)
@@ -10,14 +10,6 @@
__docformat__ = 'restructuredtext'
-try:
- from builtins import long
- PY2 = True
-except ImportError:
- # python3
- PY2 = False
- long = int
-
import os
import re
import shlex
@@ -30,6 +22,13 @@
from . import yacc
from .lex import TOKEN
+
+PY2 = True
+if sys.version_info.major == 3:
+ PY2 = False
+ long = int
+
+
tokens = (
'HEADER_NAME', 'IDENTIFIER', 'PP_NUMBER', 'CHARACTER_CONSTANT',
'STRING_LITERAL', 'OTHER',
Modified: grass/trunk/lib/python/ctypes/ctypesgencore/printer/preamble.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/printer/preamble.py 2017-08-25 20:39:57 UTC (rev 71437)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/printer/preamble.py 2017-08-26 12:39:44 UTC (rev 71438)
@@ -1,14 +1,13 @@
-try:
- from builtins import long
-except ImportError:
- long = int
-
import os
import sys
import ctypes
from ctypes import *
+if sys.version_info.major == 3:
+ long = int
+
+
_int_types = (c_int16, c_int32)
if hasattr(ctypes, 'c_int64'):
# Some builds of ctypes apparently do not have c_int64
Modified: grass/trunk/lib/python/pygrass/vector/table.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/table.py 2017-08-25 20:39:57 UTC (rev 71437)
+++ grass/trunk/lib/python/pygrass/vector/table.py 2017-08-26 12:39:44 UTC (rev 71438)
@@ -9,11 +9,9 @@
with_statement, print_function, unicode_literals)
import os
+import sys
-try:
- from builtins import long, unicode
-except ImportError:
- # python3
+if sys.version_info.major == 3:
long = int
unicode = str
Modified: grass/trunk/lib/python/pygrass/vector/testsuite/test_table.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/testsuite/test_table.py 2017-08-25 20:39:57 UTC (rev 71437)
+++ grass/trunk/lib/python/pygrass/vector/testsuite/test_table.py 2017-08-26 12:39:44 UTC (rev 71438)
@@ -4,14 +4,9 @@
@author: pietro
"""
-try:
- from builtins import long
-except ImportError:
- # python3
- long = int
-
import os
import sqlite3
+import sys
import tempfile as tmp
from string import ascii_letters, digits
from random import choice
@@ -23,6 +18,9 @@
from grass.pygrass.vector.table import Table, get_path
+if sys.version_info.major == 3:
+ long = int
+
# dictionary that generate random data
COL2VALS = {'INT': lambda n: np.random.randint(9, size=n),
'INTEGER': lambda n: np.random.randint(9, size=n),
Modified: grass/trunk/lib/python/script/raster.py
===================================================================
--- grass/trunk/lib/python/script/raster.py 2017-08-25 20:39:57 UTC (rev 71437)
+++ grass/trunk/lib/python/script/raster.py 2017-08-26 12:39:44 UTC (rev 71438)
@@ -20,6 +20,7 @@
from __future__ import absolute_import
import os
+import sys
import string
import time
@@ -28,11 +29,7 @@
from .utils import float_or_dms, parse_key_val
-try:
- from builtins import unicode
- bytes = str
-except ImportError:
- # python3
+if sys.version_info.major == 3:
unicode = str
Modified: grass/trunk/lib/python/script/task.py
===================================================================
--- grass/trunk/lib/python/script/task.py 2017-08-25 20:39:57 UTC (rev 71437)
+++ grass/trunk/lib/python/script/task.py 2017-08-26 12:39:44 UTC (rev 71438)
@@ -18,14 +18,10 @@
.. sectionauthor:: Martin Landa <landa.martin gmail.com>
"""
import re
-import types
+import sys
import string
-try:
- from builtins import unicode
- bytes = str
-except ImportError:
- # python3
+if sys.version_info.major == 3:
unicode = str
try:
Modified: grass/trunk/lib/python/temporal/core.py
===================================================================
--- grass/trunk/lib/python/temporal/core.py 2017-08-25 20:39:57 UTC (rev 71437)
+++ grass/trunk/lib/python/temporal/core.py 2017-08-26 12:39:44 UTC (rev 71438)
@@ -30,15 +30,13 @@
"""
#import traceback
import os
+import sys
import grass.script as gscript
# i18N
import gettext
gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"), 'locale'))
-try:
- from builtins import long
-except ImportError:
- # python3
+if sys.version_info.major == 3:
long = int
from .c_libraries_interface import *
More information about the grass-commit
mailing list