Backport fix done by Tobias Rzepka on pylint for python3 install on win32 platforms. Closes #180836

authorSylvain Thénault <sylvain.thenault@logilab.fr>
changesetab88a0a73cfa
branchdefault
phasedraft
hiddenyes
parent revision#bf74411c45cb [modutils] don't propagate IOError when package's __init__.py file doesn't exist. Closes #174606
child revision#92d09fece70e [modutils] ensure file is closed, may cause pb depending on the interpreter (eg pypy). Closes #180876
files modified by this revision
ChangeLog
deprecation.py
setup.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1380810978 -7200
# Thu Oct 03 16:36:18 2013 +0200
# Node ID ab88a0a73cfa018be12c925737cc5d8b63b08f7e
# Parent bf74411c45cb4c20fc40953ba67e897438fb1839
Backport fix done by Tobias Rzepka on pylint for python3 install on win32 platforms. Closes #180836

diff --git a/ChangeLog b/ChangeLog
@@ -3,10 +3,12 @@
1 
2  --
3     * modutils: don't propagate IOError when package's __init__.py file doesn't
4       exist (#174606)
5 
6 +   * fix some cases of failing python3 install on windows platform (#180836)
7 +
8  2013-07-26  --  0.60.0
9      * configuration: rename option_name method into option_attrname (#140667)
10 
11      * deprecation: new DeprecationManager class (closes #108205)
12 
diff --git a/deprecation.py b/deprecation.py
@@ -59,12 +59,10 @@
13 
14          class AnyClass(object):
15              __metaclass__ = deprecator.class_deprecated('1.2')
16      """
17      def __init__(self, module_name=None):
18 -        """
19 -        """
20          self.module_name = module_name
21          self.compatible_version = None
22 
23      def compatibility(self, compatible_version):
24          """Set the compatible version.
@@ -78,11 +76,11 @@
25          def decorator(func):
26              message = reason or 'The function "%s" is deprecated'
27              if '%s' in message:
28                  message %= func.func_name
29              def wrapped(*args, **kwargs):
30 -                self.warn(version, message, stacklevel)
31 +                self.warn(version, message, stacklevel+1)
32                  return func(*args, **kwargs)
33              return wrapped
34          return decorator
35 
36      def class_deprecated(self, version=None):
@@ -90,11 +88,11 @@
37              """metaclass to print a warning on instantiation of a deprecated class"""
38 
39              def __call__(cls, *args, **kwargs):
40                  msg = getattr(cls, "__deprecation_warning__",
41                                "%(cls)s is deprecated") % {'cls': cls.__name__}
42 -                self.warn(version, msg)
43 +                self.warn(version, msg, stacklevel=3)
44                  return type.__call__(cls, *args, **kwargs)
45          return metaclass
46 
47      def moved(self, version, modpath, objname):
48          """use to tell that a callable has been moved to a new module.
diff --git a/setup.py b/setup.py
@@ -131,21 +131,26 @@
49              if subpackage_of:
50                  base = join(subpackage_of, modname)
51              else:
52                  base = modname
53              basedir = os.path.join(self.build_lib, base)
54 +            if sys.platform == 'win32':
55 +                two_to_three = [sys.executable]
56 +                exe_path = os.path.dirname(sys.executable)
57 +                two_to_three.append(os.path.join(exe_path, 'Tools\\Scripts\\2to3.py'))
58 +            else:
59 +                two_to_three = ['2to3']
60              for directory in include_dirs:
61                  dest = join(basedir, directory)
62                  shutil.rmtree(dest, ignore_errors=True)
63                  shutil.copytree(directory, dest)
64                  if sys.version_info >= (3, 0):
65                      # process manually python file in include_dirs (test data)
66                      from subprocess import check_call
67                      # brackets are NOT optional here for py3k compat
68                      print('running 2to3 on', dest)
69 -                    # Needs `shell=True` to run on Windows.
70 -                    check_call(['2to3', '-wn', dest], shell=sys.platform=='win32')
71 +                    check_call([two_to_three + ['-wn', dest])
72 
73 
74  def install(**kwargs):
75      """setup entry point"""
76      if USE_SETUPTOOLS: