From e753cb42481783ac858ceb518aaac1472075063c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 24 Feb 2017 10:55:44 +0200 Subject: Python 3.6 invalid escape sequence deprecation fixes --- setuptools/command/easy_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/command/easy_install.py') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index d3eabfc3..f5ca0754 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -2013,7 +2013,7 @@ class ScriptWriter(object): gui apps. """ - template = textwrap.dedent(""" + template = textwrap.dedent(r""" # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r __requires__ = %(spec)r import re -- cgit v1.2.3 From 20aca0e37e2003a364098a27189c732197ccbec2 Mon Sep 17 00:00:00 2001 From: Emil Styrke Date: Mon, 27 Feb 2017 14:15:39 +0100 Subject: Fix for auto_chmod behavior Apparently, in (at least) python 3.5.2, the function that is called on Windows to remove files is os.unlink and not os.remove. This results in permission errors when trying to clean up after easy_install has been used to install a package from a Git repository. --- setuptools/command/easy_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/command/easy_install.py') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index f5ca0754..ef83f7ae 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1675,7 +1675,7 @@ def _first_line_re(): def auto_chmod(func, arg, exc): - if func is os.remove and os.name == 'nt': + if func in [os.unlink, os.remove] and os.name == 'nt': chmod(arg, stat.S_IWRITE) return func(arg) et, ev, _ = sys.exc_info() -- cgit v1.2.3 From fe3deeeebd6d5f01e803ea6bbfcf001834ca45b7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 10 Apr 2017 11:13:51 -0400 Subject: Nicer syntax for processing PYTHONPATH --- setuptools/command/easy_install.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'setuptools/command/easy_install.py') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index ef83f7ae..55d26560 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1349,9 +1349,16 @@ class easy_install(Command): def get_site_dirs(): - # return a list of 'site' dirs - sitedirs = [_f for _f in os.environ.get('PYTHONPATH', - '').split(os.pathsep) if _f] + """ + Return a list of 'site' dirs + """ + + sitedirs = [] + + # start with PYTHONPATH + pythonpath_items = os.environ.get('PYTHONPATH', '').split(os.pathsep) + sitedirs.extend(filter(None, pythonpath_items)) + prefixes = [sys.prefix] if sys.exec_prefix != sys.prefix: prefixes.append(sys.exec_prefix) -- cgit v1.2.3 From 3b18e07289d1cd4cdd046d46c244d77938732e5e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 10 Apr 2017 11:24:25 -0400 Subject: Consolidate technique for reading PYTHONPATH. --- setuptools/command/easy_install.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'setuptools/command/easy_install.py') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 55d26560..e30ca3ac 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -474,8 +474,7 @@ class easy_install(Command): else: self.pth_file = None - PYTHONPATH = os.environ.get('PYTHONPATH', '').split(os.pathsep) - if instdir not in map(normalize_path, filter(None, PYTHONPATH)): + if instdir not in map(normalize_path, _pythonpath()): # only PYTHONPATH dirs need a site.py, so pretend it's there self.sitepy_installed = True elif self.multi_version and not os.path.exists(pth_file): @@ -1348,6 +1347,11 @@ class easy_install(Command): setattr(self, attr, val) +def _pythonpath(): + items = os.environ.get('PYTHONPATH', '').split(os.pathsep) + return filter(None, items) + + def get_site_dirs(): """ Return a list of 'site' dirs @@ -1356,8 +1360,7 @@ def get_site_dirs(): sitedirs = [] # start with PYTHONPATH - pythonpath_items = os.environ.get('PYTHONPATH', '').split(os.pathsep) - sitedirs.extend(filter(None, pythonpath_items)) + sitedirs.extend(_pythonpath()) prefixes = [sys.prefix] if sys.exec_prefix != sys.prefix: -- cgit v1.2.3