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 --- CHANGES.rst | 6 ++++++ pkg_resources/tests/test_resources.py | 2 +- setuptools/command/easy_install.py | 2 +- setuptools/msvc.py | 4 ++-- setuptools/package_index.py | 8 ++++---- setuptools/sandbox.py | 4 ++-- setuptools/tests/test_bdist_egg.py | 2 +- setuptools/tests/test_easy_install.py | 2 +- 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index c6d5556f..000705b7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v34.3.1 +------- + +* #983: Fixes to invalid escape sequence deprecations on + Python 3.6. + v34.3.0 ------- diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py index f28378b9..b997aaa3 100644 --- a/pkg_resources/tests/test_resources.py +++ b/pkg_resources/tests/test_resources.py @@ -593,7 +593,7 @@ class TestParsing: [Requirement('Twis-Ted>=1.2-1')] ) assert ( - list(parse_requirements('Twisted >=1.2, \ # more\n<2.0')) + list(parse_requirements('Twisted >=1.2, \\ # more\n<2.0')) == [Requirement('Twisted>=1.2,<2.0')] ) 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 diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 97e27303..d41daec4 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -272,7 +272,7 @@ class PlatformInfo: ) def target_dir(self, hidex86=False, x64=False): - """ + r""" Target platform specific subfolder. Parameters @@ -294,7 +294,7 @@ class PlatformInfo: ) def cross_dir(self, forcex86=False): - """ + r""" Cross platform specific subfolder. Parameters diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 3544dd54..5d397b67 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -34,8 +34,8 @@ EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.+!]+)$') HREF = re.compile("""href\\s*=\\s*['"]?([^'"> ]+)""", re.I) # this is here to fix emacs' cruddy broken syntax highlighting PYPI_MD5 = re.compile( - '([^<]+)\n\s+\\(md5\\)' + '([^<]+)\n\\s+\\(md5\\)' ) URL_SCHEME = re.compile('([-+.a-z0-9]{2,}):', re.I).match EXTENSIONS = ".tar.gz .tar.bz2 .tar .zip .tgz".split() @@ -161,7 +161,7 @@ def interpret_distro_name( # versions in distribution archive names (sdist and bdist). parts = basename.split('-') - if not py_version and any(re.match('py\d\.\d$', p) for p in parts[2:]): + if not py_version and any(re.match(r'py\d\.\d$', p) for p in parts[2:]): # it is a bdist_dumb, not an sdist -- bail out return @@ -205,7 +205,7 @@ def unique_values(func): return wrapper -REL = re.compile("""<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>""", re.I) +REL = re.compile(r"""<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>""", re.I) # this line is here to fix emacs' cruddy broken syntax highlighting diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 0ddd2332..41c1c3b1 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -215,7 +215,7 @@ def _needs_hiding(mod_name): >>> _needs_hiding('Cython') True """ - pattern = re.compile('(setuptools|pkg_resources|distutils|Cython)(\.|$)') + pattern = re.compile(r'(setuptools|pkg_resources|distutils|Cython)(\.|$)') return bool(pattern.match(mod_name)) @@ -391,7 +391,7 @@ class DirectorySandbox(AbstractSandbox): _exception_patterns = [ # Allow lib2to3 to attempt to save a pickled grammar object (#121) - '.*lib2to3.*\.pickle$', + r'.*lib2to3.*\.pickle$', ] "exempt writing to paths that match the pattern" diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py index 5aabf404..d24aa366 100644 --- a/setuptools/tests/test_bdist_egg.py +++ b/setuptools/tests/test_bdist_egg.py @@ -41,4 +41,4 @@ class Test: # let's see if we got our egg link at the right place [content] = os.listdir('dist') - assert re.match('foo-0.0.0-py[23].\d.egg$', content) + assert re.match(r'foo-0.0.0-py[23].\d.egg$', content) diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index b75e6ff2..fd8300a0 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -65,7 +65,7 @@ class TestEasyInstallTest: def test_get_script_args(self): header = ei.CommandSpec.best().from_environment().as_header() - expected = header + DALS(""" + expected = header + DALS(r""" # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' __requires__ = 'spec' import re -- cgit v1.2.1 From d4c215a7c61fb1f94b88bd2aa0b332ebaff18193 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 25 Feb 2017 21:16:34 -0600 Subject: Add a test capturing new proposed expectation that Setuptools' build dependencies should not require setuptools to build in order to avoid inevitable conflicts when bootstrapping from source. Packaging fails this test. Ref #980 --- setuptools/tests/test_integration.py | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py index a83d4fe8..cb62eb29 100644 --- a/setuptools/tests/test_integration.py +++ b/setuptools/tests/test_integration.py @@ -98,3 +98,53 @@ def test_pbr(install_context): def test_python_novaclient(install_context): _install_one('python-novaclient', install_context, 'novaclient', 'base.py') + +import re +import subprocess +import functools +import tarfile, zipfile + + +build_deps = ['appdirs', 'packaging', 'pyparsing', 'six'] +@pytest.mark.parametrize("build_dep", build_deps) +@pytest.mark.skipif(sys.version_info < (3, 6), reason='run only on late versions') +def test_build_deps_on_distutils(request, tmpdir_factory, build_dep): + """ + All setuptools build dependencies must build without + setuptools. + """ + if 'pyparsing' in build_dep: + pytest.xfail(reason="Project imports setuptools unconditionally") + build_target = tmpdir_factory.mktemp('source') + build_dir = download_and_extract(request, build_dep, build_target) + install_target = tmpdir_factory.mktemp('target') + output = install(build_dir, install_target) + for line in output.splitlines(): + match = re.search('Unknown distribution option: (.*)', line) + allowed_unknowns = [ + 'test_suite', + 'tests_require', + 'install_requires', + ] + assert not match or match.group(1).strip('"\'') in allowed_unknowns + + +def install(pkg_dir, install_dir): + with open(os.path.join(pkg_dir, 'setuptools.py'), 'w') as breaker: + breaker.write('raise ImportError()') + cmd = [sys.executable, 'setup.py', 'install', '--prefix', install_dir] + env = dict(os.environ, PYTHONPATH=pkg_dir) + output = subprocess.check_output(cmd, cwd=pkg_dir, env=env, stderr=subprocess.STDOUT) + return output.decode('utf-8') + + +def download_and_extract(request, req, target): + cmd = [sys.executable, '-m', 'pip', 'download', '--no-deps', + '--no-binary', ':all:', req] + output = subprocess.check_output(cmd, encoding='utf-8') + filename = re.search('Saved (.*)', output).group(1) + request.addfinalizer(functools.partial(os.remove, filename)) + opener = zipfile.ZipFile if filename.endswith('.zip') else tarfile.open + with opener(filename) as archive: + archive.extractall(target) + return os.path.join(target, os.listdir(target)[0]) -- cgit v1.2.1 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(-) 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.1 From 76e1b4957060319545f5a1abd1494cd77a017fa8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 2 Mar 2017 19:08:58 -0500 Subject: Update changelog --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 000705b7..66af4bde 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,9 @@ v34.3.1 ------- +* #988: Trap ``os.unlink`` same as ``os.remove`` in + ``auto_chmod`` error handler. + * #983: Fixes to invalid escape sequence deprecations on Python 3.6. -- cgit v1.2.1 From c4ff7cc6551097d513d310fac6d0c099b1afa32e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 2 Mar 2017 19:18:40 -0500 Subject: =?UTF-8?q?Bump=20version:=2034.3.0=20=E2=86=92=2034.3.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 9fbe41ee..cf36f54f 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 34.3.0 +current_version = 34.3.1 commit = True tag = True diff --git a/setup.py b/setup.py index 5d436ace..6bd0cce8 100755 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="34.3.0", + version="34.3.1", description="Easily download, build, install, upgrade, and uninstall " "Python packages", author="Python Packaging Authority", -- cgit v1.2.1 From 62fc6681509f04ba7ee12e87d6ac5d6056214fa8 Mon Sep 17 00:00:00 2001 From: Florian Schulze Date: Sat, 11 Mar 2017 14:45:15 +0100 Subject: Fix documentation upload by fixing content_type in _build_multipart on Python 3.x. --- setuptools/command/upload_docs.py | 2 +- setuptools/tests/test_upload_docs.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index eeb0718b..910d5ea7 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -138,7 +138,7 @@ class upload_docs(upload): part_groups = map(builder, data.items()) parts = itertools.chain.from_iterable(part_groups) body_items = itertools.chain(parts, end_items) - content_type = 'multipart/form-data; boundary=%s' % boundary + content_type = 'multipart/form-data; boundary=%s' % boundary.decode('ascii') return b''.join(body_items), content_type def upload_file(self, filename): diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index 5d50bb0b..a26e32a6 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -64,6 +64,8 @@ class TestUploadDocsTest: ) body, content_type = upload_docs._build_multipart(data) assert 'form-data' in content_type + assert "b'" not in content_type + assert 'b"' not in content_type assert isinstance(body, bytes) assert b'foo' in body assert b'content' in body -- cgit v1.2.1 From da1dcf42236810c76c763ee9be8ba71bf213c297 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 11 Mar 2017 09:12:07 -0500 Subject: Extract variables to remove hanging indents. --- setuptools/command/upload_docs.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index 910d5ea7..468cb377 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -77,9 +77,8 @@ class upload_docs(upload): self.mkpath(self.target_dir) # just in case for root, dirs, files in os.walk(self.target_dir): if root == self.target_dir and not files: - raise DistutilsOptionError( - "no files found in upload directory '%s'" - % self.target_dir) + tmpl = "no files found in upload directory '%s'" + raise DistutilsOptionError(tmpl % self.target_dir) for name in files: full = os.path.join(root, name) relative = root[len(self.target_dir):].lstrip(os.path.sep) @@ -159,8 +158,8 @@ class upload_docs(upload): body, ct = self._build_multipart(data) - self.announce("Submitting documentation to %s" % (self.repository), - log.INFO) + msg = "Submitting documentation to %s" % (self.repository) + self.announce(msg, log.INFO) # build the Request # We can't use urllib2 since we need to send the Basic @@ -191,16 +190,16 @@ class upload_docs(upload): r = conn.getresponse() if r.status == 200: - self.announce('Server response (%s): %s' % (r.status, r.reason), - log.INFO) + msg = 'Server response (%s): %s' % (r.status, r.reason) + self.announce(msg, log.INFO) elif r.status == 301: location = r.getheader('Location') if location is None: location = 'https://pythonhosted.org/%s/' % meta.get_name() - self.announce('Upload successful. Visit %s' % location, - log.INFO) + msg = 'Upload successful. Visit %s' % location + self.announce(msg, log.INFO) else: - self.announce('Upload failed (%s): %s' % (r.status, r.reason), - log.ERROR) + msg = 'Upload failed (%s): %s' % (r.status, r.reason) + self.announce(msg, log.ERROR) if self.show_response: print('-' * 75, r.read(), '-' * 75) -- cgit v1.2.1 From 94ad54108b1584e19c79521aa487b20b1fd18f69 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 11 Mar 2017 09:14:55 -0500 Subject: Update changelog. Ref #993. --- CHANGES.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 66af4bde..cef2ddb1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,10 @@ +v34.3.2 +------- + +* #993: Fix documentation upload by correcting + rendering of content-type in _build_multipart + on Python 3. + v34.3.1 ------- -- cgit v1.2.1 From 907fc81e098e6e173501d63b4541b404d8feed2a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 11 Mar 2017 09:16:43 -0500 Subject: =?UTF-8?q?Bump=20version:=2034.3.1=20=E2=86=92=2034.3.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index cf36f54f..8a7aeabd 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 34.3.1 +current_version = 34.3.2 commit = True tag = True diff --git a/setup.py b/setup.py index 6bd0cce8..825b2f94 100755 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="34.3.1", + version="34.3.2", description="Easily download, build, install, upgrade, and uninstall " "Python packages", author="Python Packaging Authority", -- cgit v1.2.1 From 20b3b3eaa74935d4854b63f75d893def27a4248e Mon Sep 17 00:00:00 2001 From: JGoutin Date: Mon, 20 Mar 2017 17:45:57 +0100 Subject: Update for MS BuildTools 2017 --- setuptools/msvc.py | 96 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 81 insertions(+), 15 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index d41daec4..71fe24cd 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -13,6 +13,7 @@ Microsoft Visual C++ 10.0: Microsoft Visual C++ 14.0: Microsoft Visual C++ Build Tools 2015 (x86, x64, arm) + Microsoft Visual Studio Build Tools 2017 (x86, x64, arm, arm64) """ import os @@ -150,6 +151,7 @@ def msvc14_get_vc_env(plat_spec): ------------------------- Microsoft Visual C++ 14.0: Microsoft Visual C++ Build Tools 2015 (x86, x64, arm) + Microsoft Visual Studio Build Tools 2017 (x86, x64, arm, arm64) Parameters ---------- @@ -411,7 +413,7 @@ class RegistryInfo: ------ str: value """ - node64 = '' if self.pi.current_is_x86() or x86 else r'\Wow6432Node' + node64 = '' if self.pi.current_is_x86() or x86 else 'Wow6432Node' return os.path.join('Software', node64, 'Microsoft', key) def lookup(self, key, name): @@ -483,12 +485,13 @@ class SystemInfo: """ Find all available Microsoft Visual C++ versions. """ - vckeys = (self.ri.vc, self.ri.vc_for_python) + ms = self.ri.microsoft + vckeys = (self.ri.vc, self.ri.vc_for_python, self.ri.vs) vc_vers = [] for hkey in self.ri.HKEYS: for key in vckeys: try: - bkey = winreg.OpenKey(hkey, key, 0, winreg.KEY_READ) + bkey = winreg.OpenKey(hkey, ms(key), 0, winreg.KEY_READ) except (OSError, IOError): continue subkeys, values, _ = winreg.QueryInfoKey(bkey) @@ -525,9 +528,24 @@ class SystemInfo: """ Microsoft Visual C++ directory. """ - # Default path - default = r'Microsoft Visual Studio %0.1f\VC' % self.vc_ver - guess_vc = os.path.join(self.ProgramFilesx86, default) + self.VSInstallDir + + # Default path starting VS2017 + guess_vc = '' + if self.vc_ver > 14.0: + default = r'VC\Tools\MSVC' + guess_vc = os.path.join(self.VSInstallDir, default) + # Subdir with VC exact version as name + try: + vc_exact_ver = os.listdir(guess_vc)[-1] + guess_vc = os.path.join(guess_vc, vc_exact_ver) + except (OSError, IOError, IndexError): + guess_vc = '' + + # Legacy default path + if not guess_vc: + default = r'Microsoft Visual Studio %0.1f\VC' % self.vc_ver + guess_vc = os.path.join(self.ProgramFilesx86, default) # Try to get "VC++ for Python" path from registry as default path reg_path = os.path.join(self.ri.vc_for_python, '%0.1f' % self.vc_ver) @@ -725,9 +743,19 @@ class SystemInfo: bits: int Platform number of bits: 32 or 64. """ - # Find actual .NET version + # Find actual .NET version in registry ver = self.ri.lookup(self.ri.vc, 'frameworkver%d' % bits) or '' + # If nothing in registry, look in Framework folder + if not ver: + dot_net_dir = (self.FrameworkDir32 if bits == 32 else + self.FrameworkDir64) + for dir_name in reversed(os.listdir(dot_net_dir)): + if (os.path.isdir(os.path.join(dot_net_dir, dir_name)) and + dir_name.startswith('v')): + ver = dir_name + break + # Set .NET versions for specified MSVC++ version if self.vc_ver >= 12.0: frameworkver = (ver, 'v4.0') @@ -810,7 +838,10 @@ class EnvironmentInfo: """ Microsoft Visual C++ & Microsoft Foundation Class Libraries """ - arch_subdir = self.pi.target_dir(hidex86=True) + if self.vc_ver >= 15.0: + arch_subdir = self.pi.target_dir(x64=True) + else: + arch_subdir = self.pi.target_dir(hidex86=True) paths = ['Lib%s' % arch_subdir, r'ATLMFC\Lib%s' % arch_subdir] if self.vc_ver >= 14.0: @@ -840,10 +871,20 @@ class EnvironmentInfo: if arch_subdir: tools += [os.path.join(si.VCInstallDir, 'Bin%s' % arch_subdir)] - if self.vc_ver >= 14.0: + if self.vc_ver == 14.0: path = 'Bin%s' % self.pi.current_dir(hidex86=True) tools += [os.path.join(si.VCInstallDir, path)] + elif self.vc_ver >= 15.0: + host_dir = (r'bin\HostX86%s' if self.pi.current_is_x86() else + r'bin\HostX64%s') + tools += [os.path.join( + si.VCInstallDir, host_dir % self.pi.target_dir(x64=True))] + + if self.pi.current_cpu != self.pi.target_cpu: + tools += [os.path.join( + si.VCInstallDir, host_dir % self.pi.current_dir(x64=True))] + else: tools += [os.path.join(si.VCInstallDir, 'Bin')] @@ -933,8 +974,11 @@ class EnvironmentInfo: """ Microsoft Windows SDK Tools """ - bin_dir = 'Bin' if self.vc_ver <= 11.0 else r'Bin\x86' - tools = [os.path.join(self.si.WindowsSdkDir, bin_dir)] + if self.vc_ver < 15.0: + bin_dir = 'Bin' if self.vc_ver <= 11.0 else r'Bin\x86' + tools = [os.path.join(self.si.WindowsSdkDir, bin_dir)] + else: + tools = [] if not self.pi.current_is_x86(): arch_subdir = self.pi.current_dir(x64=True) @@ -949,6 +993,12 @@ class EnvironmentInfo: path = r'Bin\NETFX 4.0 Tools%s' % arch_subdir tools += [os.path.join(self.si.WindowsSdkDir, path)] + elif self.vc_ver >= 15.0: + path = os.path.join(self.si.WindowsSdkDir, 'Bin') + arch_subdir = self.pi.current_dir(x64=True) + sdkver = self._get_content_dirname(path, slash=False) + tools += [os.path.join(path, r'%s%s' % (sdkver, arch_subdir))] + if self.si.WindowsSDKExecutablePath: tools += [self.si.WindowsSDKExecutablePath] @@ -1023,10 +1073,21 @@ class EnvironmentInfo: """ if self.vc_ver < 12.0: return [] + elif self.vc_ver < 15.0: + base_path = self.si.ProgramFilesx86 + arch_subdir = self.pi.current_dir(hidex86=True) + else: + base_path = self.si.VSInstallDir + arch_subdir = '' - arch_subdir = self.pi.current_dir(hidex86=True) path = r'MSBuild\%0.1f\bin%s' % (self.vc_ver, arch_subdir) - return [os.path.join(self.si.ProgramFilesx86, path)] + build = [os.path.join(base_path, path)] + + if self.vc_ver >= 15.0: + # Add Roslyn C# & Visual Basic Compiler + build += [os.path.join(base_path, path, 'Roslyn')] + + return build @property def HTMLHelpWorkshop(self): @@ -1170,7 +1231,7 @@ class EnvironmentInfo: seen_add(k) yield element - def _get_content_dirname(self, path): + def _get_content_dirname(self, path, slash=True): """ Return name of the first dir in path or '' if no dir found. @@ -1178,6 +1239,8 @@ class EnvironmentInfo: ---------- path: str Path where search dir. + slash: bool + If not True, only return "name" not "name\" Return ------ @@ -1187,7 +1250,10 @@ class EnvironmentInfo: try: name = os.listdir(path) if name: - return '%s\\' % name[0] + name = name[0] + if slash: + return '%s\\' % name + return name return '' except (OSError, IOError): return '' -- cgit v1.2.1 From 282d7d354900dbae5724feb9af1ad7bbf617220e Mon Sep 17 00:00:00 2001 From: Jim Fulton Date: Fri, 24 Mar 2017 12:55:03 -0400 Subject: fixed incomplete import of packaging.specifiers and packaging.version This fixes: #997 --- setuptools/dist.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index be55dc4e..71c6c288 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -14,7 +14,8 @@ from distutils.util import rfc822_escape import six from six.moves import map -import packaging +import packaging.specifiers +import packaging.version from setuptools.depends import Require from setuptools import windows_support -- cgit v1.2.1 From b4d9046f6d0f9edc1afaba9a91c919026532ca43 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Mar 2017 11:44:09 -0400 Subject: Update changelog. Ref #998. --- CHANGES.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index cef2ddb1..54eba036 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,10 @@ +v34.3.3 +------- + +* #967 (and #997): Explicitly import submodules of + packaging to account for environments where the imports + of those submodules is not implied by other behavior. + v34.3.2 ------- -- cgit v1.2.1 From e05b6ae26868626d84ac8eb13955fbed0894e160 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Mar 2017 11:44:25 -0400 Subject: =?UTF-8?q?Bump=20version:=2034.3.2=20=E2=86=92=2034.3.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 8a7aeabd..7fcd65be 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 34.3.2 +current_version = 34.3.3 commit = True tag = True diff --git a/setup.py b/setup.py index 825b2f94..100acfaa 100755 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="34.3.2", + version="34.3.3", description="Easily download, build, install, upgrade, and uninstall " "Python packages", author="Python Packaging Authority", -- cgit v1.2.1 From 943833d493a95061c4c432337e7133aa311ccdba Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 30 Mar 2017 21:32:37 -0400 Subject: Update docs to use jaraco.packaging.sphinx to grab metadata from the package. --- docs/conf.py | 64 ++++++++++++++------------------------------------- docs/requirements.txt | 5 ++-- 2 files changed, 20 insertions(+), 49 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index fe684271..1b1bb5fb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,18 +18,11 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -# Allow Sphinx to find the setup command that is imported below, as referenced above. -import os -import sys -sys.path.append(os.path.abspath('..')) - -import setup as setup_script - # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['rst.linker', 'sphinx.ext.autosectionlabel'] +extensions = ['rst.linker', 'sphinx.ext.autosectionlabel', 'jaraco.packaging.sphinx'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -40,19 +33,6 @@ source_suffix = '.txt' # The master toctree document. master_doc = 'index' -# General information about the project. -project = 'Setuptools' -copyright = '2009-2014, The fellowship of the packaging' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = setup_script.setup_params['version'] -# The full version, including alpha/beta/rc tags. -release = setup_script.setup_params['version'] - # List of directories, relative to source directory, that shouldn't be searched # for source files. exclude_trees = [] @@ -69,13 +49,6 @@ html_theme = 'nature' # Add any paths that contain custom themes here, relative to this directory. html_theme_path = ['_theme'] -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -html_title = "Setuptools documentation" - -# A shorter title for the navigation bar. Default is the same as html_title. -html_short_title = "Setuptools" - # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. html_use_smartypants = True @@ -89,9 +62,6 @@ html_use_modindex = False # If false, no index is generated. html_use_index = False -# Output file base name for HTML help builder. -htmlhelp_basename = 'Setuptoolsdoc' - # -- Options for LaTeX output -------------------------------------------------- # Grouping the document tree into LaTeX files. List of tuples @@ -109,60 +79,60 @@ link_files = { ), replace=[ dict( - pattern=r"(Issue )?#(?P\d+)", - url='{GH}/pypa/setuptools/issues/{issue}', + pattern=r'(Issue )?#(?P\d+)', + url='{package_url}/issues/{issue}', ), dict( - pattern=r"BB Pull Request ?#(?P\d+)", + pattern=r'BB Pull Request ?#(?P\d+)', url='{BB}/pypa/setuptools/pull-request/{bb_pull_request}', ), dict( - pattern=r"Distribute #(?P\d+)", + pattern=r'Distribute #(?P\d+)', url='{BB}/tarek/distribute/issue/{distribute}', ), dict( - pattern=r"Buildout #(?P\d+)", + pattern=r'Buildout #(?P\d+)', url='{GH}/buildout/buildout/issues/{buildout}', ), dict( - pattern=r"Old Setuptools #(?P\d+)", + pattern=r'Old Setuptools #(?P\d+)', url='http://bugs.python.org/setuptools/issue{old_setuptools}', ), dict( - pattern=r"Jython #(?P\d+)", + pattern=r'Jython #(?P\d+)', url='http://bugs.jython.org/issue{jython}', ), dict( - pattern=r"Python #(?P\d+)", + pattern=r'Python #(?P\d+)', url='http://bugs.python.org/issue{python}', ), dict( - pattern=r"Interop #(?P\d+)", + pattern=r'Interop #(?P\d+)', url='{GH}/pypa/interoperability-peps/issues/{interop}', ), dict( - pattern=r"Pip #(?P\d+)", + pattern=r'Pip #(?P\d+)', url='{GH}/pypa/pip/issues/{pip}', ), dict( - pattern=r"Packaging #(?P\d+)", + pattern=r'Packaging #(?P\d+)', url='{GH}/pypa/packaging/issues/{packaging}', ), dict( - pattern=r"[Pp]ackaging (?P\d+(\.\d+)+)", + pattern=r'[Pp]ackaging (?P\d+(\.\d+)+)', url='{GH}/pypa/packaging/blob/{packaging_ver}/CHANGELOG.rst', ), dict( - pattern=r"PEP[- ](?P\d+)", + pattern=r'PEP[- ](?P\d+)', url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/', ), dict( - pattern=r"setuptools_svn #(?P\d+)", + pattern=r'setuptools_svn #(?P\d+)', url='{GH}/jaraco/setuptools_svn/issues/{setuptools_svn}', ), dict( - pattern=r"^(?m)((?Pv?\d+(\.\d+){1,2}))\n[-=]+\n", - with_scm="{text}\n{rev[timestamp]:%d %b %Y}\n", + pattern=r'^(?m)((?Pv?\d+(\.\d+){1,2}))\n[-=]+\n', + with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n', ), ], ), diff --git a/docs/requirements.txt b/docs/requirements.txt index 4be41887..7333dedd 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1,3 @@ -rst.linker>=1.6.1 -sphinx>=1.4 +sphinx +rst.linker>=1.9 +jaraco.packaging>=3.2 -- cgit v1.2.1 From 23d74941204535bd08aec7699566865d810b52f7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 30 Mar 2017 21:45:19 -0400 Subject: Require a late version of setuptools to allow the docs to invoke setup.py --- docs/requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index 7333dedd..2138c884 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,5 @@ sphinx rst.linker>=1.9 jaraco.packaging>=3.2 + +setuptools>=34 -- cgit v1.2.1 From 52c58bedd49552359993b533fcd86da4ff58b0c2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 30 Mar 2017 22:06:23 -0400 Subject: Add hack to invoke bootstrap script so that setup.py --version can be invoked. --- docs/conf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 1b1bb5fb..36d3f24c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,6 +18,11 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. + +# hack to run the bootstrap script so that jaraco.packaging.sphinx +# can invoke setup.py +exec(open('../bootstrap.py').read()) + # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions -- cgit v1.2.1 From b6bf75575644f8cb5457618a5a2c8e35e152052b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 30 Mar 2017 22:15:03 -0400 Subject: Check for egg info dir relative to setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 100acfaa..77abf593 100755 --- a/setup.py +++ b/setup.py @@ -15,7 +15,8 @@ here = os.path.dirname(__file__) def require_metadata(): "Prevent improper installs without necessary metadata. See #659" - if not os.path.exists('setuptools.egg-info'): + egg_info_dir = os.path.join(here, 'setuptools.egg-info') + if not os.path.exists(egg_info_dir): msg = ( "Cannot build setuptools without metadata. " "Install rwt and run `rwt -- bootstrap.py`." -- cgit v1.2.1 From c9587fe384a2eab6e9d81408abb58936d15286ed Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 30 Mar 2017 22:18:49 -0400 Subject: Try running bootstrap in subprocess in order to be in the project root. --- docs/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 36d3f24c..6119ad12 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -21,6 +21,9 @@ # hack to run the bootstrap script so that jaraco.packaging.sphinx # can invoke setup.py +import subprocess +import sys +subprocess.Popen([sys.executable, 'bootstrap.py'], cwd='..') exec(open('../bootstrap.py').read()) # -- General configuration ----------------------------------------------------- -- cgit v1.2.1 From 74329a7fa2a482309e4eb244b3920e28a76cfcbf Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 30 Mar 2017 22:23:04 -0400 Subject: Remove excess hack --- docs/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 6119ad12..15061ecf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,7 +24,6 @@ import subprocess import sys subprocess.Popen([sys.executable, 'bootstrap.py'], cwd='..') -exec(open('../bootstrap.py').read()) # -- General configuration ----------------------------------------------------- -- cgit v1.2.1 From b10187e1fa7f602d7f5cc75821d14b494625aef9 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 30 Mar 2017 22:38:03 -0400 Subject: Make sure bootstrap finishes before continuing, and ensure that jaraco.packaging.sphinx is run before rst.linker. --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 15061ecf..7f781fef 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,13 +23,13 @@ # can invoke setup.py import subprocess import sys -subprocess.Popen([sys.executable, 'bootstrap.py'], cwd='..') +subprocess.check_call([sys.executable, 'bootstrap.py'], cwd='..') # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['rst.linker', 'sphinx.ext.autosectionlabel', 'jaraco.packaging.sphinx'] +extensions = ['jaraco.packaging.sphinx', 'rst.linker', 'sphinx.ext.autosectionlabel'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] -- cgit v1.2.1 From 332b586b7c65dee7e9a2dbbcbc1c896f4a862a3f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 31 Mar 2017 08:22:38 -0400 Subject: Hack must genuflect to the arbitrory invocation location --- docs/conf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 7f781fef..28f86da4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,7 +23,9 @@ # can invoke setup.py import subprocess import sys -subprocess.check_call([sys.executable, 'bootstrap.py'], cwd='..') +import os +proj_root = os.path.join(os.path.dirname(__file__), os.path.pardir) +subprocess.check_call([sys.executable, 'bootstrap.py'], cwd=proj_root) # -- General configuration ----------------------------------------------------- -- cgit v1.2.1 From e8ca95c2e12f46e203715194e4729f8b33de2c23 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 31 Mar 2017 08:27:33 -0400 Subject: Constrain hack to the RTD environment. Rely on bootstrap routine to make dependencies available. --- docs/conf.py | 13 ++++++++----- docs/requirements.txt | 2 -- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 28f86da4..f7d02303 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,14 +18,17 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. - -# hack to run the bootstrap script so that jaraco.packaging.sphinx -# can invoke setup.py import subprocess import sys import os -proj_root = os.path.join(os.path.dirname(__file__), os.path.pardir) -subprocess.check_call([sys.executable, 'bootstrap.py'], cwd=proj_root) + + +# hack to run the bootstrap script so that jaraco.packaging.sphinx +# can invoke setup.py +'READTHEDOCS' in os.environ and subprocess.check_call( + [sys.executable, 'bootstrap.py'], + cwd=os.path.join(os.path.dirname(__file__), os.path.pardir), +) # -- General configuration ----------------------------------------------------- diff --git a/docs/requirements.txt b/docs/requirements.txt index 2138c884..7333dedd 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,3 @@ sphinx rst.linker>=1.9 jaraco.packaging>=3.2 - -setuptools>=34 -- cgit v1.2.1 From bdbe0776c19646e703bd0b89ad3f33e6797256a7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 31 Mar 2017 08:35:09 -0400 Subject: Although bootstrap.py is installing the deps, it removes them as well, so doc builds still require build deps. --- docs/requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index 7333dedd..2138c884 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,5 @@ sphinx rst.linker>=1.9 jaraco.packaging>=3.2 + +setuptools>=34 -- cgit v1.2.1 From abaf7c4dd76c56eb509f6a5f6caa2f8e886801b6 Mon Sep 17 00:00:00 2001 From: Marcel Bargull Date: Fri, 7 Apr 2017 13:42:51 +0200 Subject: Fixes #999: support python_requires, py_modules in configuration files --- docs/setuptools.txt | 2 ++ setuptools/config.py | 1 + setuptools/dist.py | 4 +++- setuptools/tests/test_config.py | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/setuptools.txt b/docs/setuptools.txt index f0da6e1d..bf5bb8ce 100644 --- a/docs/setuptools.txt +++ b/docs/setuptools.txt @@ -2425,6 +2425,7 @@ zip_safe bool setup_requires list-semi install_requires list-semi extras_require section +python_requires str entry_points file:, section use_2to3 bool use_2to3_fixers list-comma @@ -2440,6 +2441,7 @@ package_dir dict package_data section exclude_package_data section namespace_packages list-comma +py_modules list-comma ======================= ===== .. note:: diff --git a/setuptools/config.py b/setuptools/config.py index 39a01f88..252f2deb 100644 --- a/setuptools/config.py +++ b/setuptools/config.py @@ -462,6 +462,7 @@ class ConfigOptionsHandler(ConfigHandler): 'tests_require': parse_list_semicolon, 'packages': self._parse_packages, 'entry_points': self._parse_file, + 'py_modules': parse_list, } def _parse_packages(self, value): diff --git a/setuptools/dist.py b/setuptools/dist.py index 71c6c288..fd1d28c2 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -166,7 +166,7 @@ def check_specifier(dist, attr, value): packaging.specifiers.SpecifierSet(value) except packaging.specifiers.InvalidSpecifier as error: tmpl = ( - "{attr!r} must be a string or list of strings " + "{attr!r} must be a string " "containing valid version specifiers; {error}" ) raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) @@ -353,6 +353,8 @@ class Distribution(Distribution_parse_config_files, _Distribution): _Distribution.parse_config_files(self, filenames=filenames) parse_configuration(self, self.command_options) + if getattr(self, 'python_requires', None): + self.metadata.python_requires = self.python_requires def parse_command_line(self): """Process features after parsing command line options""" diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 799fb165..8bd2a494 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -312,6 +312,8 @@ class TestOptions: 'setup_requires = docutils>=0.3; spack ==1.1, ==1.3; there\n' 'dependency_links = http://some.com/here/1, ' 'http://some.com/there/2\n' + 'python_requires = >=1.0, !=2.8\n' + 'py_modules = module1, module2\n' ) with get_dist(tmpdir) as dist: assert dist.zip_safe @@ -340,6 +342,8 @@ class TestOptions: 'there' ]) assert dist.tests_require == ['mock==0.7.2', 'pytest'] + assert dist.python_requires == '>=1.0, !=2.8' + assert dist.py_modules == ['module1', 'module2'] def test_multiline(self, tmpdir): fake_env( -- cgit v1.2.1 From b504713684e8adeff8bcaeafec5196ec7806c558 Mon Sep 17 00:00:00 2001 From: Marcel Bargull Date: Fri, 7 Apr 2017 16:33:40 +0200 Subject: Update changelog. Ref #1007. --- CHANGES.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 54eba036..12d4cc58 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,10 @@ +v34.4.0 +------- + +* #999 via #1007: Extend support for declarative package + config in a setup.cfg file to include the options + ``python_requires`` and ``py_modules``. + v34.3.3 ------- -- cgit v1.2.1 From ac59ef12d16c13533ead6401bdb4727016be77e3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 7 Apr 2017 21:52:18 -0400 Subject: extract two functions for guessing the VC version; ref #995 --- setuptools/msvc.py | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 71fe24cd..cf556ad3 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -530,22 +530,7 @@ class SystemInfo: """ self.VSInstallDir - # Default path starting VS2017 - guess_vc = '' - if self.vc_ver > 14.0: - default = r'VC\Tools\MSVC' - guess_vc = os.path.join(self.VSInstallDir, default) - # Subdir with VC exact version as name - try: - vc_exact_ver = os.listdir(guess_vc)[-1] - guess_vc = os.path.join(guess_vc, vc_exact_ver) - except (OSError, IOError, IndexError): - guess_vc = '' - - # Legacy default path - if not guess_vc: - default = r'Microsoft Visual Studio %0.1f\VC' % self.vc_ver - guess_vc = os.path.join(self.ProgramFilesx86, default) + guess_vc = self._guess_vc() or self._guess_vc_legacy() # Try to get "VC++ for Python" path from registry as default path reg_path = os.path.join(self.ri.vc_for_python, '%0.1f' % self.vc_ver) @@ -561,6 +546,30 @@ class SystemInfo: return path + def _guess_vc(self): + """ + Locate Visual C for 2017 + """ + + if self.vc_ver <= 14.0: + return + + default = r'VC\Tools\MSVC' + guess_vc = os.path.join(self.VSInstallDir, default) + # Subdir with VC exact version as name + try: + vc_exact_ver = os.listdir(guess_vc)[-1] + return os.path.join(guess_vc, vc_exact_ver) + except (OSError, IOError, IndexError): + pass + + def _guess_vc_legacy(self): + """ + Locate Visual C for versions prior to 2017 + """ + default = r'Microsoft Visual Studio %0.1f\VC' % self.vc_ver + return os.path.join(self.ProgramFilesx86, default) + @property def WindowsSdkVersion(self): """ -- cgit v1.2.1 From 934d6707b1d8c55c930d458e39b11038e9276a4d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 7 Apr 2017 22:07:30 -0400 Subject: Extract method for finding .Net in the framework folder. Ref #995. --- setuptools/msvc.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index cf556ad3..1588cd2e 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -753,17 +753,9 @@ class SystemInfo: Platform number of bits: 32 or 64. """ # Find actual .NET version in registry - ver = self.ri.lookup(self.ri.vc, 'frameworkver%d' % bits) or '' - - # If nothing in registry, look in Framework folder - if not ver: - dot_net_dir = (self.FrameworkDir32 if bits == 32 else - self.FrameworkDir64) - for dir_name in reversed(os.listdir(dot_net_dir)): - if (os.path.isdir(os.path.join(dot_net_dir, dir_name)) and - dir_name.startswith('v')): - ver = dir_name - break + reg_ver = self.ri.lookup(self.ri.vc, 'frameworkver%d' % bits) + dot_net_dir = getattr(self, 'FrameworkDir%d' % bits) + ver = reg_ver or self._find_dot_net_in(dot_net_dir) or '' # Set .NET versions for specified MSVC++ version if self.vc_ver >= 12.0: @@ -777,6 +769,18 @@ class SystemInfo: frameworkver = ('v3.0', 'v2.0.50727') return frameworkver + def _find_dot_net_in(self, dot_net_dir): + """ + Find .Net in the Framework folder + """ + matching_dirs = ( + dir_name + for dir_name in reversed(os.listdir(dot_net_dir)) + if os.path.isdir(os.path.join(dot_net_dir, dir_name)) + and dir_name.startswith('v') + ) + return next(matching_dirs, None) + class EnvironmentInfo: """ -- cgit v1.2.1 From 9430e92f888a7c41f295373bd8a6ef8af967e2e1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 7 Apr 2017 22:19:06 -0400 Subject: Move initialization into a single location. Ref #995. --- setuptools/msvc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 1588cd2e..baf2021e 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -987,11 +987,11 @@ class EnvironmentInfo: """ Microsoft Windows SDK Tools """ + tools = [] + if self.vc_ver < 15.0: bin_dir = 'Bin' if self.vc_ver <= 11.0 else r'Bin\x86' - tools = [os.path.join(self.si.WindowsSdkDir, bin_dir)] - else: - tools = [] + tools += [os.path.join(self.si.WindowsSdkDir, bin_dir)] if not self.pi.current_is_x86(): arch_subdir = self.pi.current_dir(x64=True) -- cgit v1.2.1 From 3fa9efcbb390b87304ddc64551e9fca823694773 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 7 Apr 2017 22:23:18 -0400 Subject: Extract generator for simpler syntax. Ref #995. --- setuptools/msvc.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index baf2021e..c5a8aea0 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -987,16 +987,17 @@ class EnvironmentInfo: """ Microsoft Windows SDK Tools """ - tools = [] + return list(self._sdk_tools()) + def _sdk_tools(self): if self.vc_ver < 15.0: bin_dir = 'Bin' if self.vc_ver <= 11.0 else r'Bin\x86' - tools += [os.path.join(self.si.WindowsSdkDir, bin_dir)] + yield os.path.join(self.si.WindowsSdkDir, bin_dir) if not self.pi.current_is_x86(): arch_subdir = self.pi.current_dir(x64=True) path = 'Bin%s' % arch_subdir - tools += [os.path.join(self.si.WindowsSdkDir, path)] + yield os.path.join(self.si.WindowsSdkDir, path) if self.vc_ver == 10.0 or self.vc_ver == 11.0: if self.pi.target_is_x86(): @@ -1004,18 +1005,16 @@ class EnvironmentInfo: else: arch_subdir = self.pi.current_dir(hidex86=True, x64=True) path = r'Bin\NETFX 4.0 Tools%s' % arch_subdir - tools += [os.path.join(self.si.WindowsSdkDir, path)] + yield os.path.join(self.si.WindowsSdkDir, path) elif self.vc_ver >= 15.0: path = os.path.join(self.si.WindowsSdkDir, 'Bin') arch_subdir = self.pi.current_dir(x64=True) sdkver = self._get_content_dirname(path, slash=False) - tools += [os.path.join(path, r'%s%s' % (sdkver, arch_subdir))] + yield os.path.join(path, r'%s%s' % (sdkver, arch_subdir)) if self.si.WindowsSDKExecutablePath: - tools += [self.si.WindowsSDKExecutablePath] - - return tools + yield self.si.WindowsSDKExecutablePath @property def SdkSetup(self): -- cgit v1.2.1 From f357a32fdc9ce8e6a862efcbb9a0229f6f0a685c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 7 Apr 2017 22:30:49 -0400 Subject: Simplify _get_content_dirname by simply removing the trailing backslash. Ref #995. --- setuptools/msvc.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index c5a8aea0..9a911834 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -1010,7 +1010,7 @@ class EnvironmentInfo: elif self.vc_ver >= 15.0: path = os.path.join(self.si.WindowsSdkDir, 'Bin') arch_subdir = self.pi.current_dir(x64=True) - sdkver = self._get_content_dirname(path, slash=False) + sdkver = self._get_content_dirname(path).rstrip('\\') yield os.path.join(path, r'%s%s' % (sdkver, arch_subdir)) if self.si.WindowsSDKExecutablePath: @@ -1243,7 +1243,7 @@ class EnvironmentInfo: seen_add(k) yield element - def _get_content_dirname(self, path, slash=True): + def _get_content_dirname(self, path): """ Return name of the first dir in path or '' if no dir found. @@ -1251,8 +1251,6 @@ class EnvironmentInfo: ---------- path: str Path where search dir. - slash: bool - If not True, only return "name" not "name\" Return ------ @@ -1262,10 +1260,7 @@ class EnvironmentInfo: try: name = os.listdir(path) if name: - name = name[0] - if slash: - return '%s\\' % name - return name + return '%s\\' % name[0] return '' except (OSError, IOError): return '' -- cgit v1.2.1 From cd13a8c0c4ee765a8bd083863338dec4ba618d08 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 7 Apr 2017 22:33:28 -0400 Subject: Remove unnecessary raw string. Ref #995. --- setuptools/msvc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 9a911834..35c02129 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -1011,7 +1011,7 @@ class EnvironmentInfo: path = os.path.join(self.si.WindowsSdkDir, 'Bin') arch_subdir = self.pi.current_dir(x64=True) sdkver = self._get_content_dirname(path).rstrip('\\') - yield os.path.join(path, r'%s%s' % (sdkver, arch_subdir)) + yield os.path.join(path, '%s%s' % (sdkver, arch_subdir)) if self.si.WindowsSDKExecutablePath: yield self.si.WindowsSDKExecutablePath -- cgit v1.2.1 From 76ac9dcbc17a4d04c201667f47c8ee040ef5c8ea Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 7 Apr 2017 22:36:51 -0400 Subject: Update changelog. Ref #995. --- CHANGES.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index cef2ddb1..37098e8c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v34.4.0 +------- + +* #995: In MSVC support, add support for Microsoft + Build Tools 2017. + v34.3.2 ------- -- cgit v1.2.1 From 315e8ffaa3886e7988ff29238e5240bc33317eea Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 7 Apr 2017 22:40:46 -0400 Subject: =?UTF-8?q?Bump=20version:=2034.3.3=20=E2=86=92=2034.4.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 7fcd65be..fcade157 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 34.3.3 +current_version = 34.4.0 commit = True tag = True diff --git a/setup.py b/setup.py index 77abf593..0ccc6631 100755 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="34.3.3", + version="34.4.0", description="Easily download, build, install, upgrade, and uninstall " "Python packages", author="Python Packaging Authority", -- cgit v1.2.1 From f420bb2093f85d3aa34e732c42133b0e2e06ecd9 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Apr 2017 10:18:31 -0400 Subject: Let the default vc_min_ver represent the most lenient, degenerate limit. --- setuptools/msvc.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 35c02129..75745e67 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -806,15 +806,14 @@ class EnvironmentInfo: # Variables and properties in this class use originals CamelCase variables # names from Microsoft source files for more easy comparaison. - def __init__(self, arch, vc_ver=None, vc_min_ver=None): + def __init__(self, arch, vc_ver=None, vc_min_ver=0): self.pi = PlatformInfo(arch) self.ri = RegistryInfo(self.pi) self.si = SystemInfo(self.ri, vc_ver) - if vc_min_ver: - if self.vc_ver < vc_min_ver: - err = 'No suitable Microsoft Visual C++ version found' - raise distutils.errors.DistutilsPlatformError(err) + if self.vc_ver < vc_min_ver: + err = 'No suitable Microsoft Visual C++ version found' + raise distutils.errors.DistutilsPlatformError(err) @property def vc_ver(self): -- cgit v1.2.1 From 66177c944536aab86994f6df7172c0d9d6acb5cf Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Apr 2017 10:20:47 -0400 Subject: Extract private method for locating latest available vc ver. --- setuptools/msvc.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 75745e67..d739178b 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -472,14 +472,14 @@ class SystemInfo: def __init__(self, registry_info, vc_ver=None): self.ri = registry_info self.pi = self.ri.pi - if vc_ver: - self.vc_ver = vc_ver - else: - try: - self.vc_ver = self.find_available_vc_vers()[-1] - except IndexError: - err = 'No Microsoft Visual C++ version found' - raise distutils.errors.DistutilsPlatformError(err) + self.vc_ver = vc_ver or self._find_latest_available_vc_ver() + + def _find_latest_available_vc_ver(self): + try: + return self.find_available_vc_vers()[-1] + except IndexError: + err = 'No Microsoft Visual C++ version found' + raise distutils.errors.DistutilsPlatformError(err) def find_available_vc_vers(self): """ -- cgit v1.2.1 From c86965048dee300bc4d985afc72e5de7267658b3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Apr 2017 10:29:23 -0400 Subject: spaces for consistency --- setuptools/py27compat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setuptools/py27compat.py b/setuptools/py27compat.py index f0a80a8e..4b6fae91 100644 --- a/setuptools/py27compat.py +++ b/setuptools/py27compat.py @@ -20,8 +20,8 @@ if sys.version_info < (3,): linux_py2_ascii = ( - platform.system() == 'Linux' and - sys.version_info < (3,) + platform.system() == 'Linux' and + sys.version_info < (3,) ) rmtree_safe = str if linux_py2_ascii else lambda x: x -- cgit v1.2.1 From 1d928cbc7b2cfcf1ffd2ec27f83ee33f0af39dfe Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Apr 2017 10:35:00 -0400 Subject: Use six to detect Python 2 --- setuptools/py27compat.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setuptools/py27compat.py b/setuptools/py27compat.py index 4b6fae91..701283c8 100644 --- a/setuptools/py27compat.py +++ b/setuptools/py27compat.py @@ -2,9 +2,10 @@ Compatibility Support for Python 2.7 and earlier """ -import sys import platform +import six + def get_all_headers(message, key): """ @@ -13,15 +14,14 @@ def get_all_headers(message, key): return message.get_all(key) -if sys.version_info < (3,): - +if six.PY2: def get_all_headers(message, key): return message.getheaders(key) linux_py2_ascii = ( platform.system() == 'Linux' and - sys.version_info < (3,) + six.PY2 ) rmtree_safe = str if linux_py2_ascii else lambda x: x -- cgit v1.2.1 From b50fdf497d6970002a2f7156650d7da21e2e39f5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Apr 2017 10:44:34 -0400 Subject: In msvc9_query_vcvarsall, ensure dict values are not unicode. Fixes #992. --- CHANGES.rst | 7 +++++++ setuptools/msvc.py | 5 ++++- setuptools/py27compat.py | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 081e2cfe..85ba8cbf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,10 @@ +v34.4.1 +------- + +* #992: In msvc.msvc9_query_vcvarsall, ensure the + returned dicts have str values and not Unicode for + compatibilty with os.environ. + v34.4.0 ------- diff --git a/setuptools/msvc.py b/setuptools/msvc.py index d739178b..1e7a3277 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -26,6 +26,7 @@ from packaging.version import LegacyVersion from six.moves import filterfalse from .monkey import get_unpatched +from . import py27compat if platform.system() == 'Windows': from six.moves import winreg @@ -134,11 +135,13 @@ def msvc9_query_vcvarsall(ver, arch='x86', *args, **kwargs): # If error, try to set environment directly try: - return EnvironmentInfo(arch, ver).return_env() + env = EnvironmentInfo(arch, ver).return_env() except distutils.errors.DistutilsPlatformError as exc: _augment_exception(exc, ver, arch) raise + return py27compat.make_dict_values_strings(env) + def msvc14_get_vc_env(plat_spec): """ diff --git a/setuptools/py27compat.py b/setuptools/py27compat.py index 701283c8..0f924889 100644 --- a/setuptools/py27compat.py +++ b/setuptools/py27compat.py @@ -26,3 +26,17 @@ linux_py2_ascii = ( rmtree_safe = str if linux_py2_ascii else lambda x: x """Workaround for http://bugs.python.org/issue24672""" + + +def dict_values_strings(dict_): + """ + Given a dict, make sure the text values are str. + """ + if six.PY3: + return dict_ + + # When dropping Python 2.6 support, use a dict constructor + return dict( + (key, str(value)) + for key, value in dict_.iteritems() + ) -- cgit v1.2.1 From 6ab912d1f676604d71e8e2090d262002f78929d4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 8 Apr 2017 11:23:32 -0400 Subject: Correct typo. Ref #992. --- setuptools/msvc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 1e7a3277..3970bfaf 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -140,7 +140,7 @@ def msvc9_query_vcvarsall(ver, arch='x86', *args, **kwargs): _augment_exception(exc, ver, arch) raise - return py27compat.make_dict_values_strings(env) + return py27compat.dict_values_strings(env) def msvc14_get_vc_env(plat_spec): -- cgit v1.2.1 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(-) 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.1 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(-) 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.1 From a1aa1be06bdef8824c8954bb74dc9a57f324f826 Mon Sep 17 00:00:00 2001 From: JGoutin Date: Mon, 10 Apr 2017 17:56:48 +0200 Subject: Fixes for Visual Studio 2017 - VCRuntimeRedist new path since VS2017. - Use always last Windows SDK and UCRT SDK when more than one version are available. - Minors docstrings changes. Tested with "Visual Studio 2017 Community" and "Visual Studio Build Tools 2017". --- setuptools/msvc.py | 130 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 79 insertions(+), 51 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 3970bfaf..3110eaff 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -4,15 +4,16 @@ Improved support for Microsoft Visual C++ compilers. Known supported compilers: -------------------------- Microsoft Visual C++ 9.0: - Microsoft Visual C++ Compiler for Python 2.7 (x86, amd64); - Microsoft Windows SDK 7.0 (x86, x64, ia64); + Microsoft Visual C++ Compiler for Python 2.7 (x86, amd64) Microsoft Windows SDK 6.1 (x86, x64, ia64) + Microsoft Windows SDK 7.0 (x86, x64, ia64) Microsoft Visual C++ 10.0: Microsoft Windows SDK 7.1 (x86, x64, ia64) Microsoft Visual C++ 14.0: Microsoft Visual C++ Build Tools 2015 (x86, x64, arm) + Microsoft Visual Studio 2017 (x86, x64, arm, arm64) Microsoft Visual Studio Build Tools 2017 (x86, x64, arm, arm64) """ @@ -96,7 +97,7 @@ def msvc9_find_vcvarsall(version): def msvc9_query_vcvarsall(ver, arch='x86', *args, **kwargs): """ - Patched "distutils.msvc9compiler.query_vcvarsall" for support standalones + Patched "distutils.msvc9compiler.query_vcvarsall" for support extra compilers. Set environment without use of "vcvarsall.bat". @@ -104,9 +105,9 @@ def msvc9_query_vcvarsall(ver, arch='x86', *args, **kwargs): Known supported compilers ------------------------- Microsoft Visual C++ 9.0: - Microsoft Visual C++ Compiler for Python 2.7 (x86, amd64); - Microsoft Windows SDK 7.0 (x86, x64, ia64); + Microsoft Visual C++ Compiler for Python 2.7 (x86, amd64) Microsoft Windows SDK 6.1 (x86, x64, ia64) + Microsoft Windows SDK 7.0 (x86, x64, ia64) Microsoft Visual C++ 10.0: Microsoft Windows SDK 7.1 (x86, x64, ia64) @@ -145,7 +146,7 @@ def msvc9_query_vcvarsall(ver, arch='x86', *args, **kwargs): def msvc14_get_vc_env(plat_spec): """ - Patched "distutils._msvccompiler._get_vc_env" for support standalones + Patched "distutils._msvccompiler._get_vc_env" for support extra compilers. Set environment without use of "vcvarsall.bat". @@ -154,6 +155,7 @@ def msvc14_get_vc_env(plat_spec): ------------------------- Microsoft Visual C++ 14.0: Microsoft Visual C++ Build Tools 2015 (x86, x64, arm) + Microsoft Visual Studio 2017 (x86, x64, arm, arm64) Microsoft Visual Studio Build Tools 2017 (x86, x64, arm, arm64) Parameters @@ -553,7 +555,6 @@ class SystemInfo: """ Locate Visual C for 2017 """ - if self.vc_ver <= 14.0: return @@ -576,9 +577,8 @@ class SystemInfo: @property def WindowsSdkVersion(self): """ - Microsoft Windows SDK versions. + Microsoft Windows SDK versions for specified MSVC++ version. """ - # Set Windows SDK versions for specified MSVC++ version if self.vc_ver <= 9.0: return ('7.0', '6.1', '6.0a') elif self.vc_ver == 10.0: @@ -590,6 +590,14 @@ class SystemInfo: elif self.vc_ver >= 14.0: return ('10.0', '8.1') + @property + def WindowsSdkLastVersion(self): + """ + Microsoft Windows SDK last version + """ + return self._use_last_dir_name(os.path.join( + self.WindowsSdkDir, 'lib')) + @property def WindowsSdkDir(self): """ @@ -687,6 +695,14 @@ class SystemInfo: break return sdkdir or '' + @property + def UniversalCRTSdkLastVersion(self): + """ + Microsoft Universal C Runtime SDK last version + """ + return self._use_last_dir_name(os.path.join( + self.UniversalCRTSdkDir, 'lib')) + @property def NetFxSdkVersion(self): """ @@ -746,7 +762,7 @@ class SystemInfo: """ return self._find_dot_net_versions(64) - def _find_dot_net_versions(self, bits=32): + def _find_dot_net_versions(self, bits): """ Find Microsoft .NET Framework versions. @@ -758,7 +774,7 @@ class SystemInfo: # Find actual .NET version in registry reg_ver = self.ri.lookup(self.ri.vc, 'frameworkver%d' % bits) dot_net_dir = getattr(self, 'FrameworkDir%d' % bits) - ver = reg_ver or self._find_dot_net_in(dot_net_dir) or '' + ver = reg_ver or self._use_last_dir_name(dot_net_dir, 'v') or '' # Set .NET versions for specified MSVC++ version if self.vc_ver >= 12.0: @@ -772,17 +788,24 @@ class SystemInfo: frameworkver = ('v3.0', 'v2.0.50727') return frameworkver - def _find_dot_net_in(self, dot_net_dir): + def _use_last_dir_name(self, path, prefix=''): """ - Find .Net in the Framework folder + Return name of the last dir in path or '' if no dir found. + + Parameters + ---------- + path: str + Use dirs in this path + prefix: str + Use only dirs startings by this prefix """ matching_dirs = ( dir_name - for dir_name in reversed(os.listdir(dot_net_dir)) - if os.path.isdir(os.path.join(dot_net_dir, dir_name)) - and dir_name.startswith('v') + for dir_name in reversed(os.listdir(path)) + if os.path.isdir(os.path.join(path, dir_name)) and + dir_name.startswith(prefix) ) - return next(matching_dirs, None) + return next(matching_dirs, None) or '' class EnvironmentInfo: @@ -917,8 +940,8 @@ class EnvironmentInfo: else: arch_subdir = self.pi.target_dir(x64=True) lib = os.path.join(self.si.WindowsSdkDir, 'lib') - libver = self._get_content_dirname(lib) - return [os.path.join(lib, '%sum%s' % (libver, arch_subdir))] + libver = self._sdk_subdir + return [os.path.join(lib, '%sum%s' % (libver , arch_subdir))] @property def OSIncludes(self): @@ -932,7 +955,7 @@ class EnvironmentInfo: else: if self.vc_ver >= 14.0: - sdkver = self._get_content_dirname(include) + sdkver = self._sdk_subdir else: sdkver = '' return [os.path.join(include, '%sshared' % sdkver), @@ -992,6 +1015,9 @@ class EnvironmentInfo: return list(self._sdk_tools()) def _sdk_tools(self): + """ + Microsoft Windows SDK Tools paths generator + """ if self.vc_ver < 15.0: bin_dir = 'Bin' if self.vc_ver <= 11.0 else r'Bin\x86' yield os.path.join(self.si.WindowsSdkDir, bin_dir) @@ -1012,12 +1038,20 @@ class EnvironmentInfo: elif self.vc_ver >= 15.0: path = os.path.join(self.si.WindowsSdkDir, 'Bin') arch_subdir = self.pi.current_dir(x64=True) - sdkver = self._get_content_dirname(path).rstrip('\\') + sdkver = self.si.WindowsSdkLastVersion yield os.path.join(path, '%s%s' % (sdkver, arch_subdir)) if self.si.WindowsSDKExecutablePath: yield self.si.WindowsSDKExecutablePath + @property + def _sdk_subdir(self): + """ + Microsoft Windows SDK version subdir + """ + ucrtver = self.si.WindowsSdkLastVersion + return ('%s\\' % ucrtver) if ucrtver else '' + @property def SdkSetup(self): """ @@ -1116,27 +1150,34 @@ class EnvironmentInfo: @property def UCRTLibraries(self): """ - Microsoft Universal CRT Libraries + Microsoft Universal C Runtime SDK Libraries """ if self.vc_ver < 14.0: return [] arch_subdir = self.pi.target_dir(x64=True) lib = os.path.join(self.si.UniversalCRTSdkDir, 'lib') - ucrtver = self._get_content_dirname(lib) + ucrtver = self._ucrt_subdir return [os.path.join(lib, '%sucrt%s' % (ucrtver, arch_subdir))] @property def UCRTIncludes(self): """ - Microsoft Universal CRT Include + Microsoft Universal C Runtime SDK Include """ if self.vc_ver < 14.0: return [] include = os.path.join(self.si.UniversalCRTSdkDir, 'include') - ucrtver = self._get_content_dirname(include) - return [os.path.join(include, '%sucrt' % ucrtver)] + return [os.path.join(include, '%sucrt' % self._ucrt_subdir)] + + @property + def _ucrt_subdir(self): + """ + Microsoft Universal C Runtime SDK version subdir + """ + ucrtver = self.si.UniversalCRTSdkLastVersion + return ('%s\\' % ucrtver) if ucrtver else '' @property def FSharp(self): @@ -1154,9 +1195,18 @@ class EnvironmentInfo: Microsoft Visual C++ runtime redistribuable dll """ arch_subdir = self.pi.target_dir(x64=True) - vcruntime = 'redist%s\\Microsoft.VC%d0.CRT\\vcruntime%d0.dll' - vcruntime = vcruntime % (arch_subdir, self.vc_ver, self.vc_ver) - return os.path.join(self.si.VCInstallDir, vcruntime) + if self.vc_ver < 15: + redist_path = self.si.VCInstallDir + vcruntime = 'redist%s\\Microsoft.VC%d0.CRT\\vcruntime%d0.dll' + else: + redist_path = self.si.VCInstallDir.replace('\\Tools', '\\Redist') + vcruntime = 'onecore%s\\Microsoft.VC%d0.CRT\\vcruntime%d0.dll' + + # Visual Studio 2017 is still Visual C++ 14.0 + dll_ver = 14.0 if self.vc_ver == 15 else self.vc_ver + + vcruntime = vcruntime % (arch_subdir, self.vc_ver, dll_ver) + return os.path.join(redist_path, vcruntime) def return_env(self, exists=True): """ @@ -1244,25 +1294,3 @@ class EnvironmentInfo: if k not in seen: seen_add(k) yield element - - def _get_content_dirname(self, path): - """ - Return name of the first dir in path or '' if no dir found. - - Parameters - ---------- - path: str - Path where search dir. - - Return - ------ - foldername: str - "name\" or "" - """ - try: - name = os.listdir(path) - if name: - return '%s\\' % name[0] - return '' - except (OSError, IOError): - return '' -- cgit v1.2.1 From e7b62cfe6df1239f6ec5c00f9223799008a80502 Mon Sep 17 00:00:00 2001 From: JGoutin Date: Mon, 10 Apr 2017 18:02:02 +0200 Subject: Add #1008 changes --- CHANGES.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 85ba8cbf..bf4daf76 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,8 @@ +v34.4.2 +------- +* #1008: In MSVC support, use always the last version available for Windows SDK and UCRT SDK. +* #1008: In MSVC support, fix "vcruntime140.dll" returned path with Visual Studio 2017. + v34.4.1 ------- @@ -8,8 +13,7 @@ v34.4.1 v34.4.0 ------- -* #995: In MSVC support, add support for Microsoft - Build Tools 2017. +* #995: In MSVC support, add support for "Microsoft Visual Studio 2017" and "Microsoft Visual Studio Build Tools 2017". * #999 via #1007: Extend support for declarative package config in a setup.cfg file to include the options -- cgit v1.2.1 From 4489bc183b74a554356d9504816a15ad122726b1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 10 Apr 2017 12:03:47 -0400 Subject: Update whitespace for consistency and better rendering --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index bf4daf76..f06a0c85 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,5 +1,6 @@ v34.4.2 ------- + * #1008: In MSVC support, use always the last version available for Windows SDK and UCRT SDK. * #1008: In MSVC support, fix "vcruntime140.dll" returned path with Visual Studio 2017. -- cgit v1.2.1 From 38ab8c0009f10e72c71cbdb1df56915e99459510 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 10 Apr 2017 12:04:23 -0400 Subject: =?UTF-8?q?Bump=20version:=2034.4.0=20=E2=86=92=2034.4.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index fcade157..686da2f6 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 34.4.0 +current_version = 34.4.1 commit = True tag = True diff --git a/setup.py b/setup.py index 0ccc6631..798cf845 100755 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="34.4.0", + version="34.4.1", description="Easily download, build, install, upgrade, and uninstall " "Python packages", author="Python Packaging Authority", -- cgit v1.2.1 From 6f05117f5c66e1c77c3a55ac90f91779b72e1d5b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 10 Apr 2017 12:05:49 -0400 Subject: Update changelog to combine 34.4.1 and 34.4.2 as the former was never released. Ref #1008. --- CHANGES.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index f06a0c85..18583f0b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,11 +1,9 @@ -v34.4.2 +v34.4.1 ------- * #1008: In MSVC support, use always the last version available for Windows SDK and UCRT SDK. -* #1008: In MSVC support, fix "vcruntime140.dll" returned path with Visual Studio 2017. -v34.4.1 -------- +* #1008: In MSVC support, fix "vcruntime140.dll" returned path with Visual Studio 2017. * #992: In msvc.msvc9_query_vcvarsall, ensure the returned dicts have str values and not Unicode for -- cgit v1.2.1 From a9d403889def99bdb1a1d02b47b8247b3af0817a Mon Sep 17 00:00:00 2001 From: Igor Starikov Date: Wed, 12 Apr 2017 12:06:37 +0700 Subject: Docs: notes on setup.cfg and ez_setup (see # 1006) --- docs/setuptools.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/setuptools.txt b/docs/setuptools.txt index bf5bb8ce..eb9fdbd3 100644 --- a/docs/setuptools.txt +++ b/docs/setuptools.txt @@ -1176,6 +1176,8 @@ Distributing a ``setuptools``-based project Using ``setuptools``... Without bundling it! --------------------------------------------- +.. warning:: **ez_setup** is deprecated in favor of PIP with **PEP-518** support. + Your users might not have ``setuptools`` installed on their machines, or even if they do, it might not be the right version. Fixing this is easy; just download `ez_setup.py`_, and put it in the same directory as your ``setup.py`` @@ -2277,6 +2279,11 @@ New in 20.1: Added keyring support. Configuring setup() using setup.cfg files ----------------------------------------- +.. note:: New in 30.3.0 (8 Dec 2016). + +.. important:: ``setup.py`` with ``setup()`` function call is still required even + if your configuration resides in ``setup.cfg``. + ``Setuptools`` allows using configuration files (usually `setup.cfg`) to define package’s metadata and other options which are normally supplied to ``setup()`` function. -- cgit v1.2.1 From 1955e5b0df67cc1aa389b8c655199958a6fcc6a0 Mon Sep 17 00:00:00 2001 From: Stefano Miccoli Date: Thu, 13 Apr 2017 22:57:56 +0200 Subject: addresses #436 --- setuptools/command/egg_info.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 1a6ea9cb..21bbfb72 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -564,8 +564,6 @@ class manifest_maker(sdist): rcfiles = list(walk_revctrl()) if rcfiles: self.filelist.extend(rcfiles) - elif os.path.exists(self.manifest): - self.read_manifest() ei_cmd = self.get_finalized_command('egg_info') self.filelist.graft(ei_cmd.egg_info) -- cgit v1.2.1 From 17720e7ce95523f013bca29ff5913e3317eb5ac1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 15 Apr 2017 09:54:47 -0500 Subject: Update changelog. Ref #1014. --- CHANGES.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 18583f0b..e6691486 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,16 @@ +v35.0.0 +------- + +* #436: In egg_info.manifest_maker, no longer read + the file list from the manifest file, and instead + re-build it on each build. In this way, files removed + from the specification will not linger in the manifest. + As a result, any files manually added to the manifest + will be removed on subsequent egg_info invocations. + No projects should be manually adding files to the + manifest and should instead use MANIFEST.in or SCM + file finders to force inclusion of files in the manifest. + v34.4.1 ------- -- cgit v1.2.1 From 9869424e3e74a41e39563e9b4b507c760660673c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 15 Apr 2017 09:55:06 -0500 Subject: =?UTF-8?q?Bump=20version:=2034.4.1=20=E2=86=92=2035.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 686da2f6..57ca3d50 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 34.4.1 +current_version = 35.0.0 commit = True tag = True diff --git a/setup.py b/setup.py index 798cf845..328941c1 100755 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="34.4.1", + version="35.0.0", description="Easily download, build, install, upgrade, and uninstall " "Python packages", author="Python Packaging Authority", -- cgit v1.2.1 From 862da01619666f94a56724180a31753bf98fd29d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 15 Apr 2017 10:06:46 -0500 Subject: Mark failures as allowed. Ref #1015. --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index adb2f948..fd18a33a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,9 @@ matrix: env: LC_ALL=C LC_CTYPE=C - python: 2.7 env: LC_ALL=C LC_CTYPE=C + allow_failures: + # https://github.com/pypa/setuptools/issues/1015 + - python: nightly script: # need tox and rwt to get started - pip install tox rwt -- cgit v1.2.1 From 74b46ceaf9affd65da0ba0d2d56e58a85955a652 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 16 Apr 2017 09:00:53 -0500 Subject: Revert "In msvc9_query_vcvarsall, ensure dict values are not unicode. Fixes #992." This reverts commit b50fdf497d6970002a2f7156650d7da21e2e39f5. --- setuptools/msvc.py | 5 +---- setuptools/py27compat.py | 14 -------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 3110eaff..84dcb2a7 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -27,7 +27,6 @@ from packaging.version import LegacyVersion from six.moves import filterfalse from .monkey import get_unpatched -from . import py27compat if platform.system() == 'Windows': from six.moves import winreg @@ -136,13 +135,11 @@ def msvc9_query_vcvarsall(ver, arch='x86', *args, **kwargs): # If error, try to set environment directly try: - env = EnvironmentInfo(arch, ver).return_env() + return EnvironmentInfo(arch, ver).return_env() except distutils.errors.DistutilsPlatformError as exc: _augment_exception(exc, ver, arch) raise - return py27compat.dict_values_strings(env) - def msvc14_get_vc_env(plat_spec): """ diff --git a/setuptools/py27compat.py b/setuptools/py27compat.py index 0f924889..701283c8 100644 --- a/setuptools/py27compat.py +++ b/setuptools/py27compat.py @@ -26,17 +26,3 @@ linux_py2_ascii = ( rmtree_safe = str if linux_py2_ascii else lambda x: x """Workaround for http://bugs.python.org/issue24672""" - - -def dict_values_strings(dict_): - """ - Given a dict, make sure the text values are str. - """ - if six.PY3: - return dict_ - - # When dropping Python 2.6 support, use a dict constructor - return dict( - (key, str(value)) - for key, value in dict_.iteritems() - ) -- cgit v1.2.1 From 0a32f2290aed6db34a142de0d5c0d607b60c6a05 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 16 Apr 2017 09:01:55 -0500 Subject: Update changelog. Ref #992. --- CHANGES.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index e6691486..426622a1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v35.0.1 +------- + +* #992: Revert change introduced in v34.4.1, now + considered invalid. + v35.0.0 ------- -- cgit v1.2.1 From 58fa3b44e5130b0cf79523c876f46a07734db7ba Mon Sep 17 00:00:00 2001 From: Pi Delport Date: Tue, 18 Apr 2017 17:10:47 +0200 Subject: Add an integration test to install pyuri This test is also a regression test for issue #1016. --- setuptools/tests/test_integration.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py index cb62eb29..2acec91b 100644 --- a/setuptools/tests/test_integration.py +++ b/setuptools/tests/test_integration.py @@ -99,6 +99,21 @@ def test_python_novaclient(install_context): _install_one('python-novaclient', install_context, 'novaclient', 'base.py') + +def test_pyuri(install_context): + """ + Install the pyuri package (version 0.3.1 at the time of writing). + + This is also a regression test for issue #1016. + """ + _install_one('pyuri', install_context, 'pyuri', 'uri.py') + + pyuri = install_context.installed_projects['pyuri'] + + # The package data should be installed. + assert os.path.exists(os.path.join(pyuri.location, 'pyuri', 'uri.regex')) + + import re import subprocess import functools -- cgit v1.2.1 From 1163c86b3b62258f28964c2aee8483631a85c892 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 18 Apr 2017 17:52:44 -0500 Subject: Revert "addresses #436". Fixes #1016. This reverts commit 1955e5b0df67cc1aa389b8c655199958a6fcc6a0. --- setuptools/command/egg_info.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 21bbfb72..1a6ea9cb 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -564,6 +564,8 @@ class manifest_maker(sdist): rcfiles = list(walk_revctrl()) if rcfiles: self.filelist.extend(rcfiles) + elif os.path.exists(self.manifest): + self.read_manifest() ei_cmd = self.get_finalized_command('egg_info') self.filelist.graft(ei_cmd.egg_info) -- cgit v1.2.1 From 07ca50a90f78bb8ffd499dd67a64cd2d021c1747 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 18 Apr 2017 18:10:13 -0500 Subject: Update changelog. Ref #1016. --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 426622a1..ebd18360 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,11 @@ v35.0.1 * #992: Revert change introduced in v34.4.1, now considered invalid. +* #1016: Revert change introduced in v35.0.0 per #1014, + referencing #436. The approach had unintended + consequences, causing sdist installs to be missing + files. + v35.0.0 ------- -- cgit v1.2.1 From 413d1e9a9585a5fe170c72b46fdd3ed4c094f848 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 18 Apr 2017 18:10:23 -0500 Subject: =?UTF-8?q?Bump=20version:=2035.0.0=20=E2=86=92=2035.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 57ca3d50..da62ac4f 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 35.0.0 +current_version = 35.0.1 commit = True tag = True diff --git a/setup.py b/setup.py index 328941c1..df732511 100755 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="35.0.0", + version="35.0.1", description="Easily download, build, install, upgrade, and uninstall " "Python packages", author="Python Packaging Authority", -- cgit v1.2.1 From f1a9711815acab7e2d9c77b86b43117f72c5c78f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 18 Apr 2017 18:32:40 -0500 Subject: Pass flags programmatically, avoiding deprecating trailing pattern flags syntax revealed in #1015. --- setuptools/command/egg_info.py | 3 ++- setuptools/tests/test_manifest.py | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 1a6ea9cb..151e495b 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -112,7 +112,8 @@ def translate_pattern(glob): if not last_chunk: pat += sep - return re.compile(pat + r'\Z(?ms)') + pat += r'\Z' + return re.compile(pat, flags=re.MULTILINE|re.DOTALL) class egg_info(Command): diff --git a/setuptools/tests/test_manifest.py b/setuptools/tests/test_manifest.py index 3b34c888..57347b53 100644 --- a/setuptools/tests/test_manifest.py +++ b/setuptools/tests/test_manifest.py @@ -71,26 +71,26 @@ def get_pattern(glob): def test_translated_pattern_test(): l = make_local_path - assert get_pattern('foo') == r'foo\Z(?ms)' - assert get_pattern(l('foo/bar')) == l(r'foo\/bar\Z(?ms)') + assert get_pattern('foo') == r'foo\Z' + assert get_pattern(l('foo/bar')) == l(r'foo\/bar\Z') # Glob matching - assert get_pattern('*.txt') == l(r'[^\/]*\.txt\Z(?ms)') - assert get_pattern('dir/*.txt') == l(r'dir\/[^\/]*\.txt\Z(?ms)') - assert get_pattern('*/*.py') == l(r'[^\/]*\/[^\/]*\.py\Z(?ms)') + assert get_pattern('*.txt') == l(r'[^\/]*\.txt\Z') + assert get_pattern('dir/*.txt') == l(r'dir\/[^\/]*\.txt\Z') + assert get_pattern('*/*.py') == l(r'[^\/]*\/[^\/]*\.py\Z') assert get_pattern('docs/page-?.txt') \ - == l(r'docs\/page\-[^\/]\.txt\Z(?ms)') + == l(r'docs\/page\-[^\/]\.txt\Z') # Globstars change what they mean depending upon where they are - assert get_pattern(l('foo/**/bar')) == l(r'foo\/(?:[^\/]+\/)*bar\Z(?ms)') - assert get_pattern(l('foo/**')) == l(r'foo\/.*\Z(?ms)') - assert get_pattern(l('**')) == r'.*\Z(?ms)' + assert get_pattern(l('foo/**/bar')) == l(r'foo\/(?:[^\/]+\/)*bar\Z') + assert get_pattern(l('foo/**')) == l(r'foo\/.*\Z') + assert get_pattern(l('**')) == r'.*\Z' # Character classes - assert get_pattern('pre[one]post') == r'pre[one]post\Z(?ms)' - assert get_pattern('hello[!one]world') == r'hello[^one]world\Z(?ms)' - assert get_pattern('[]one].txt') == r'[\]one]\.txt\Z(?ms)' - assert get_pattern('foo[!]one]bar') == r'foo[^\]one]bar\Z(?ms)' + assert get_pattern('pre[one]post') == r'pre[one]post\Z' + assert get_pattern('hello[!one]world') == r'hello[^one]world\Z' + assert get_pattern('[]one].txt') == r'[\]one]\.txt\Z' + assert get_pattern('foo[!]one]bar') == r'foo[^\]one]bar\Z' class TempDirTestCase(object): -- cgit v1.2.1 From d8e1ed570126dfc99ed7f9126df3bfc890e7005d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 18 Apr 2017 21:00:50 -0500 Subject: Rewrite tests to test the actual matching rather than making assertions about the regular expressions. Fixes #1015. --- .travis.yml | 3 -- setuptools/tests/test_manifest.py | 103 ++++++++++++++++++++++++++++++-------- 2 files changed, 83 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index fd18a33a..adb2f948 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,9 +14,6 @@ matrix: env: LC_ALL=C LC_CTYPE=C - python: 2.7 env: LC_ALL=C LC_CTYPE=C - allow_failures: - # https://github.com/pypa/setuptools/issues/1015 - - python: nightly script: # need tox and rwt to get started - pip install tox rwt diff --git a/setuptools/tests/test_manifest.py b/setuptools/tests/test_manifest.py index 57347b53..28cbca1a 100644 --- a/setuptools/tests/test_manifest.py +++ b/setuptools/tests/test_manifest.py @@ -6,6 +6,7 @@ import os import shutil import sys import tempfile +import itertools from distutils import log from distutils.errors import DistutilsTemplateError @@ -65,32 +66,94 @@ default_files = frozenset(map(make_local_path, [ ])) -def get_pattern(glob): - return translate_pattern(make_local_path(glob)).pattern - - -def test_translated_pattern_test(): - l = make_local_path - assert get_pattern('foo') == r'foo\Z' - assert get_pattern(l('foo/bar')) == l(r'foo\/bar\Z') +translate_specs = [ + ('foo', ['foo'], ['bar', 'foobar']), + ('foo/bar', ['foo/bar'], ['foo/bar/baz', './foo/bar', 'foo']), # Glob matching - assert get_pattern('*.txt') == l(r'[^\/]*\.txt\Z') - assert get_pattern('dir/*.txt') == l(r'dir\/[^\/]*\.txt\Z') - assert get_pattern('*/*.py') == l(r'[^\/]*\/[^\/]*\.py\Z') - assert get_pattern('docs/page-?.txt') \ - == l(r'docs\/page\-[^\/]\.txt\Z') + ('*.txt', ['foo.txt', 'bar.txt'], ['foo/foo.txt']), + ('dir/*.txt', ['dir/foo.txt', 'dir/bar.txt', 'dir/.txt'], ['notdir/foo.txt']), + ('*/*.py', ['bin/start.py'], []), + ('docs/page-?.txt', ['docs/page-9.txt'], ['docs/page-10.txt']), # Globstars change what they mean depending upon where they are - assert get_pattern(l('foo/**/bar')) == l(r'foo\/(?:[^\/]+\/)*bar\Z') - assert get_pattern(l('foo/**')) == l(r'foo\/.*\Z') - assert get_pattern(l('**')) == r'.*\Z' + ( + 'foo/**/bar', + ['foo/bing/bar', 'foo/bing/bang/bar', 'foo/bar'], + ['foo/abar'], + ), + ( + 'foo/**', + ['foo/bar/bing.py', 'foo/x'], + ['/foo/x'], + ), + ( + '**', + ['x', 'abc/xyz', '@nything'], + [], + ), # Character classes - assert get_pattern('pre[one]post') == r'pre[one]post\Z' - assert get_pattern('hello[!one]world') == r'hello[^one]world\Z' - assert get_pattern('[]one].txt') == r'[\]one]\.txt\Z' - assert get_pattern('foo[!]one]bar') == r'foo[^\]one]bar\Z' + ( + 'pre[one]post', + ['preopost', 'prenpost', 'preepost'], + ['prepost', 'preonepost'], + ), + + ( + 'hello[!one]world', + ['helloxworld', 'helloyworld'], + ['hellooworld', 'helloworld', 'hellooneworld'], + ), + + ( + '[]one].txt', + ['o.txt', '].txt', 'e.txt'], + ['one].txt'], + ), + + ( + 'foo[!]one]bar', + ['fooybar'], + ['foo]bar', 'fooobar', 'fooebar'], + ), + +] +""" +A spec of inputs for 'translate_pattern' and matches and mismatches +for that input. +""" + +match_params = itertools.chain.from_iterable( + zip(itertools.repeat(pattern), matches) + for pattern, matches, mismatches in translate_specs +) + + +@pytest.fixture(params=match_params) +def pattern_match(request): + return map(make_local_path, request.param) + + +mismatch_params = itertools.chain.from_iterable( + zip(itertools.repeat(pattern), mismatches) + for pattern, matches, mismatches in translate_specs +) + + +@pytest.fixture(params=mismatch_params) +def pattern_mismatch(request): + return map(make_local_path, request.param) + + +def test_translated_pattern_match(pattern_match): + pattern, target = pattern_match + assert translate_pattern(pattern).match(target) + + +def test_translated_pattern_mismatch(pattern_mismatch): + pattern, target = pattern_mismatch + assert not translate_pattern(pattern).match(target) class TempDirTestCase(object): -- cgit v1.2.1 From b1cb67c743de2581f9393315b23777011c22ecf7 Mon Sep 17 00:00:00 2001 From: Nick Douma Date: Thu, 27 Apr 2017 11:44:56 +0200 Subject: Use a different method to lookup base classes on Jython Jython seems to implement inspect.getmro differently, which causes any classes with the same name as a class lower in the MRO not to be returned. This patch offloads the MRO lookup to a separate function, which implements different logic for Jython only. Ref #1024 --- setuptools/monkey.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/setuptools/monkey.py b/setuptools/monkey.py index 68fad9dd..97ba159d 100644 --- a/setuptools/monkey.py +++ b/setuptools/monkey.py @@ -21,6 +21,19 @@ if you think you need this functionality. """ +def get_mro(cls): + """Returns the bases classes for cls sorted by the MRO. + + Works around an issue on Jython where inspect.getmro will not return all + base classes if multiple classes share the same name. Instead, this + function will return a tuple containing the class itself, and the contents + of cls.__bases__ . + """ + if platform.python_implementation() != "Jython": + return inspect.getmro(cls) + return (cls,) + cls.__bases__ + + def get_unpatched(item): lookup = ( get_unpatched_class if isinstance(item, six.class_types) else @@ -38,7 +51,7 @@ def get_unpatched_class(cls): """ external_bases = ( cls - for cls in inspect.getmro(cls) + for cls in get_mro(cls) if not cls.__module__.startswith('setuptools') ) base = next(external_bases) -- cgit v1.2.1 From 8219fe5211aebbc8de8da9c988cc2a2b85b92829 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 27 Apr 2017 15:28:54 -0400 Subject: Make _get_mro private; Swap logic to put preferred behavior at top level; Update docstring to reference issue. --- setuptools/monkey.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/setuptools/monkey.py b/setuptools/monkey.py index 97ba159d..acd0a4f4 100644 --- a/setuptools/monkey.py +++ b/setuptools/monkey.py @@ -21,17 +21,18 @@ if you think you need this functionality. """ -def get_mro(cls): - """Returns the bases classes for cls sorted by the MRO. +def _get_mro(cls): + """ + Returns the bases classes for cls sorted by the MRO. Works around an issue on Jython where inspect.getmro will not return all base classes if multiple classes share the same name. Instead, this function will return a tuple containing the class itself, and the contents - of cls.__bases__ . + of cls.__bases__. See https://github.com/pypa/setuptools/issues/1024. """ - if platform.python_implementation() != "Jython": - return inspect.getmro(cls) - return (cls,) + cls.__bases__ + if platform.python_implementation() == "Jython": + return (cls,) + cls.__bases__ + return inspect.getmro(cls) def get_unpatched(item): @@ -51,7 +52,7 @@ def get_unpatched_class(cls): """ external_bases = ( cls - for cls in get_mro(cls) + for cls in _get_mro(cls) if not cls.__module__.startswith('setuptools') ) base = next(external_bases) -- cgit v1.2.1 From 81c15b5010c3005ec8d77e89a3f974e54be8d10f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 27 Apr 2017 15:31:43 -0400 Subject: Update changelog. Ref #1025. --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index ebd18360..d83eb9d8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,8 @@ +v35.0.2 +------- + +* #1024: Add workaround for Jython #2581 in monkey module. + v35.0.1 ------- -- cgit v1.2.1 From d2dfacad71021417cf2cf082d0687774c3188142 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 27 Apr 2017 15:36:34 -0400 Subject: Update changelog. Ref #1015. --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index d83eb9d8..1ac719df 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,8 @@ v35.0.2 ------- +* #1015: Fix test failures on Python 3.7. + * #1024: Add workaround for Jython #2581 in monkey module. v35.0.1 -- cgit v1.2.1 From 44d2c01914baff076853f6402655589dde070703 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 27 Apr 2017 15:36:45 -0400 Subject: =?UTF-8?q?Bump=20version:=2035.0.1=20=E2=86=92=2035.0.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index da62ac4f..cb247aaf 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 35.0.1 +current_version = 35.0.2 commit = True tag = True diff --git a/setup.py b/setup.py index df732511..0d465cc8 100755 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ def pypi_link(pkg_filename): setup_params = dict( name="setuptools", - version="35.0.1", + version="35.0.2", description="Easily download, build, install, upgrade, and uninstall " "Python packages", author="Python Packaging Authority", -- cgit v1.2.1 From ddeea9fac9629e183c74a2a92199240a95714211 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 11 May 2017 14:26:16 -0400 Subject: Remove stale references to rwt. Ref #1018. --- .travis.yml | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index adb2f948..a49822f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,8 @@ matrix: - python: 2.7 env: LC_ALL=C LC_CTYPE=C script: - # need tox and rwt to get started - - pip install tox rwt + # need tox to get started + - pip install tox # Output the env, to verify behavior - env diff --git a/setup.py b/setup.py index 0d465cc8..e222ba93 100755 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ def require_metadata(): if not os.path.exists(egg_info_dir): msg = ( "Cannot build setuptools without metadata. " - "Install rwt and run `rwt -- bootstrap.py`." + "Install rwt and run `bootstrap.py`." ) raise RuntimeError(msg) -- cgit v1.2.1 From 6a645af13ac4ef4dd2c4012c47f8d21d529358a7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 11 May 2017 14:32:38 -0400 Subject: Remove another reference to rwt. Ref #1018. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e222ba93..6b9da273 100755 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ def require_metadata(): if not os.path.exists(egg_info_dir): msg = ( "Cannot build setuptools without metadata. " - "Install rwt and run `bootstrap.py`." + "Run `bootstrap.py`." ) raise RuntimeError(msg) -- cgit v1.2.1 From 094a8909470795a0a5c18a616a0cd2f4d10a19e2 Mon Sep 17 00:00:00 2001 From: Pi Delport Date: Wed, 19 Apr 2017 10:26:11 +0200 Subject: Add bootstrap instructions to tox.ini This will help get new contributors started, if they're just used to running "tox". --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 6b43dcd8..342b034e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,5 @@ +# Note: Run "python bootstrap.py" before running Tox, to generate metadata. + [testenv] deps= -rtests/requirements.txt -- cgit v1.2.1 From f60c81e570ec3187eeeb92c4ad4f0a788fdeaec6 Mon Sep 17 00:00:00 2001 From: Pi Delport Date: Wed, 19 Apr 2017 13:41:34 +0200 Subject: Add snippet for running Tox against all supported Pythons --- tox.ini | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tox.ini b/tox.ini index 342b034e..c81a3391 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,8 @@ # Note: Run "python bootstrap.py" before running Tox, to generate metadata. +# +# To run Tox against all supported Python interpreters, you can set: +# +# export TOXENV='py2{6,7},py3{3,4,5,6},pypy' [testenv] deps= -- cgit v1.2.1 From efcc426349bef47ff8698245af99e34e3489988d Mon Sep 17 00:00:00 2001 From: Pi Delport Date: Wed, 19 Apr 2017 13:43:54 +0200 Subject: Add the pytest cache directory to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ec3d0e35..e8d18b31 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ setuptools.egg-info *~ .hg* requirements.txt +.cache -- cgit v1.2.1 From d919999bf8c37b2efad7d6eb57ec2f5ff340799e Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Tue, 16 May 2017 11:13:30 +0300 Subject: Document -s to run single test Fixes https://github.com/pypa/setuptools/issues/1032 --- setuptools/command/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/command/test.py b/setuptools/command/test.py index e7a386d1..29227d79 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -67,7 +67,7 @@ class test(Command): user_options = [ ('test-module=', 'm', "Run 'test_suite' in specified module"), ('test-suite=', 's', - "Test suite to run (e.g. 'some_module.test_suite')"), + "Run single test, case or suite (e.g. 'module.test_suite')"), ('test-runner=', 'r', "Test runner to use"), ] -- cgit v1.2.1 From 7474f891cd5f62b0ef2af286096b47f8497e5d0d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 May 2017 11:08:53 -0400 Subject: Remove extraneous whitespace and empty comment --- setuptools/sandbox.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 41c1c3b1..9c4ff336 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -486,6 +486,3 @@ This package cannot be safely installed by EasyInstall, and may not support alternate installation locations even if you run its setup script by hand. Please inform the package's author and the EasyInstall maintainers to find out if a fix or workaround is available.""" % self.args - - -# -- cgit v1.2.1 From d6959fca54137c47abb9c3f7a0cbd1d0fd3704d3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 May 2017 11:12:01 -0400 Subject: Use dedent and left strip to store the template inside the class. --- setuptools/sandbox.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 9c4ff336..4711fec2 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -7,6 +7,7 @@ import itertools import re import contextlib import pickle +import textwrap import six from six.moves import builtins, map @@ -476,13 +477,17 @@ WRITE_FLAGS = functools.reduce( class SandboxViolation(DistutilsError): """A setup script attempted to modify the filesystem outside the sandbox""" - def __str__(self): - return """SandboxViolation: %s%r %s + tmpl = textwrap.dedent(""" + SandboxViolation: %s%r %s + + The package setup script has attempted to modify files on your system + that are not within the EasyInstall build area, and has been aborted. -The package setup script has attempted to modify files on your system -that are not within the EasyInstall build area, and has been aborted. + This package cannot be safely installed by EasyInstall, and may not + support alternate installation locations even if you run its setup + script by hand. Please inform the package's author and the EasyInstall + maintainers to find out if a fix or workaround is available. + """).lstrip() -This package cannot be safely installed by EasyInstall, and may not -support alternate installation locations even if you run its setup -script by hand. Please inform the package's author and the EasyInstall -maintainers to find out if a fix or workaround is available.""" % self.args + def __str__(self): + return self.tmpl % self.args -- cgit v1.2.1 From c96c3ffba9f8a6ab43e6f3d57349a46e3076c374 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 May 2017 11:30:58 -0400 Subject: Expand test to cover string rendering of SandboxViolation --- setuptools/tests/test_sandbox.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 929f0a5b..2b3d859e 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -126,3 +126,7 @@ class TestExceptionSaver: assert cmd == 'open' assert args == ('/etc/foo', 'w') assert kwargs == {} + + msg = str(caught.value) + assert 'open' in msg + assert "('/etc/foo', 'w')" in msg -- cgit v1.2.1 From d48cb39b4666477da1d954d3604023095c233869 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 May 2017 11:31:55 -0400 Subject: Use new style format strings and expand args to variables for better clarity of purpose. --- setuptools/sandbox.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 4711fec2..53964f4b 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -478,7 +478,7 @@ class SandboxViolation(DistutilsError): """A setup script attempted to modify the filesystem outside the sandbox""" tmpl = textwrap.dedent(""" - SandboxViolation: %s%r %s + SandboxViolation: {cmd}{args!r} {kwargs} The package setup script has attempted to modify files on your system that are not within the EasyInstall build area, and has been aborted. @@ -490,4 +490,5 @@ class SandboxViolation(DistutilsError): """).lstrip() def __str__(self): - return self.tmpl % self.args + cmd, args, kwargs = self.args + return self.tmpl.format(**locals()) -- cgit v1.2.1 From 20567bef2a36b259d2209cc76fd11a61ad288853 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 May 2017 11:42:04 -0400 Subject: Implement AbstractSandbox as a context manager. --- setuptools/sandbox.py | 31 ++++++++++++++++--------------- setuptools/tests/test_sandbox.py | 4 ++-- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 53964f4b..14f18d74 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -249,11 +249,9 @@ def run_setup(setup_script, args): setup_script.encode(sys.getfilesystemencoding()) ) - def runner(): + with DirectorySandbox(setup_dir): ns = dict(__file__=dunder_file, __name__='__main__') _execfile(setup_script, ns) - - DirectorySandbox(setup_dir).run(runner) except SystemExit as v: if v.args and v.args[0]: raise @@ -275,21 +273,24 @@ class AbstractSandbox: for name in self._attrs: setattr(os, name, getattr(source, name)) + def __enter__(self): + self._copy(self) + if _file: + builtins.file = self._file + builtins.open = self._open + self._active = True + + def __exit__(self, exc_type, exc_value, traceback): + self._active = False + if _file: + builtins.file = _file + builtins.open = _open + self._copy(_os) + def run(self, func): """Run 'func' under os sandboxing""" - try: - self._copy(self) - if _file: - builtins.file = self._file - builtins.open = self._open - self._active = True + with self: return func() - finally: - self._active = False - if _file: - builtins.file = _file - builtins.open = _open - self._copy(_os) def _mk_dual_path_wrapper(name): original = getattr(_os, name) diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 2b3d859e..6b0400f3 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -12,8 +12,8 @@ from setuptools.sandbox import DirectorySandbox class TestSandbox: def test_devnull(self, tmpdir): - sandbox = DirectorySandbox(str(tmpdir)) - sandbox.run(self._file_writer(os.devnull)) + with DirectorySandbox(str(tmpdir)): + self._file_writer(os.devnull) @staticmethod def _file_writer(path): -- cgit v1.2.1 From 8d3ed39696c5932a48b5f4a3768caa9f9e8c54b8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 May 2017 11:47:44 -0400 Subject: Just use class in its namespace --- setuptools/tests/test_sandbox.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 6b0400f3..a3f1206d 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -7,12 +7,11 @@ import pytest import pkg_resources import setuptools.sandbox -from setuptools.sandbox import DirectorySandbox class TestSandbox: def test_devnull(self, tmpdir): - with DirectorySandbox(str(tmpdir)): + with setuptools.sandbox.DirectorySandbox(str(tmpdir)): self._file_writer(os.devnull) @staticmethod @@ -116,11 +115,11 @@ class TestExceptionSaver: with open('/etc/foo', 'w'): pass - sandbox = DirectorySandbox(str(tmpdir)) with pytest.raises(setuptools.sandbox.SandboxViolation) as caught: with setuptools.sandbox.save_modules(): setuptools.sandbox.hide_setuptools() - sandbox.run(write_file) + with setuptools.sandbox.DirectorySandbox(str(tmpdir)): + write_file() cmd, args, kwargs = caught.value.args assert cmd == 'open' -- cgit v1.2.1 From 4dc2c76b62a5071dfacf434555dfa8ec2be0b433 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 May 2017 12:10:24 -0400 Subject: Temporarily pin backports.unittest_mock to 1.2 to bypass the issue reported in #1038. --- tests/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 88a36c63..6e2e78e2 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,3 +1,4 @@ pytest-flake8 pytest>=3.0.2 -backports.unittest_mock>=1.2 +# pinned to 1.2 as temporary workaround for #1038 +backports.unittest_mock>=1.2,<1.3 -- cgit v1.2.1