remove Python2 code
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
# remove this once python2 support has stopped
|
||||
|
||||
def __exec_new__(text, globals, locals):
|
||||
exec(text, globals, locals)
|
||||
@@ -1,5 +0,0 @@
|
||||
# remove this file once the python2 support has stopped
|
||||
|
||||
|
||||
def __exec_old__(text, globals, locals):
|
||||
exec text in globals, locals # noqa: E999 a Python 3 syntax error
|
||||
@@ -2386,7 +2386,6 @@ TEMPLATE_HEADER = """\
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
#
|
||||
|
||||
from __future__ import print_function # this allows py2 to print(str1,str2) correctly
|
||||
|
||||
import sys
|
||||
import getopt
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
#
|
||||
|
||||
from __future__ import print_function # this allows py2 to print(str1,str2) correctly
|
||||
|
||||
import sys
|
||||
import getopt
|
||||
|
||||
@@ -2,25 +2,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2007 Jürgen Riegel
|
||||
|
||||
from __future__ import print_function # this allows py2 to print(str1,str2) correctly
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def temporary_exec(text, globals, locals):
|
||||
"""this function is a dirty hack to allow using the copier from
|
||||
python2 and python3. Once the support of python2 has stopped
|
||||
feel free to remove this function and use the std exec function
|
||||
instead"""
|
||||
# maybe this should be fixed by rewriting the generators.
|
||||
if sys.version_info[0] < 3:
|
||||
from .__exec_old import __exec_old__
|
||||
__exec_old__(text, globals, locals)
|
||||
else:
|
||||
from .__exec_new import __exec_new__
|
||||
__exec_new__(text, globals, locals)
|
||||
|
||||
|
||||
def ensureDir(path,mode=0o777):
|
||||
try:
|
||||
os.makedirs(path,mode)
|
||||
@@ -92,7 +76,7 @@ class copier:
|
||||
stat = self.preproc(stat, 'exec')
|
||||
stat = '%s _cb(%s,%s)' % (stat,i+1,j)
|
||||
# for debugging, uncomment...: print("-> Executing: {"+stat+"}")
|
||||
temporary_exec(stat, self.globals, self.locals)
|
||||
exec(stat, self.globals, self.locals)
|
||||
i=j+1
|
||||
else: # normal line, just copy with substitution
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user