From 14827711f669a830190313951ab5aef7b71ab2c6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Nov 2016 15:54:07 -0500 Subject: Install -nspkg.pth under develop command. Fixes namespace package support as long as __init__.py is omitted. --- setuptools/command/develop.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py index 3eb86120..8de24fd7 100755 --- a/setuptools/command/develop.py +++ b/setuptools/command/develop.py @@ -9,10 +9,11 @@ from setuptools.extern import six from pkg_resources import Distribution, PathMetadata, normalize_path from setuptools.command.easy_install import easy_install +from setuptools import namespaces import setuptools -class develop(easy_install): +class develop(namespaces.DevelopInstaller, easy_install): """Set up package for development""" description = "install package in 'development mode'" @@ -123,6 +124,8 @@ class develop(easy_install): self.easy_install(setuptools.bootstrap_install_from) setuptools.bootstrap_install_from = None + self.install_namespaces() + # create an .egg-link in the installation dir, pointing to our egg log.info("Creating %s (link to %s)", self.egg_link, self.egg_base) if not self.dry_run: -- cgit v1.2.1 From 355603259aa37e424cf7466c3de6518375a935e3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Nov 2016 16:41:23 -0500 Subject: Add uninstall support for namespace packages --- setuptools/command/develop.py | 1 + 1 file changed, 1 insertion(+) (limited to 'setuptools/command') diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py index 8de24fd7..aa82f959 100755 --- a/setuptools/command/develop.py +++ b/setuptools/command/develop.py @@ -31,6 +31,7 @@ class develop(namespaces.DevelopInstaller, easy_install): if self.uninstall: self.multi_version = True self.uninstall_link() + self.uninstall_namespaces() else: self.install_for_development() self.warn_deprecated_options() -- cgit v1.2.1 From 980c2c5afd20fb9f7e50cb8ec0c42abc664da352 Mon Sep 17 00:00:00 2001 From: Tim Heap Date: Thu, 15 Dec 2016 10:11:37 +1100 Subject: Revert "Fix #849 global-exclude globbing" This reverts commit 23aba916e1070d3cf9723af85a6ce07c89053931. --- setuptools/command/egg_info.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 8a06e496..6f8fd874 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -457,7 +457,7 @@ class FileList(_FileList): """ if self.allfiles is None: self.findall() - match = translate_pattern(os.path.join('**', '*' + pattern)) + match = translate_pattern(os.path.join('**', pattern)) found = [f for f in self.allfiles if match.match(f)] self.extend(found) return bool(found) @@ -466,7 +466,7 @@ class FileList(_FileList): """ Exclude all files anywhere that match the pattern. """ - match = translate_pattern(os.path.join('**', '*' + pattern)) + match = translate_pattern(os.path.join('**', pattern)) return self._remove_files(match.match) def append(self, item): -- cgit v1.2.1 From 9f37eb817df5d9453e49edbcf2760832f333af68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 16 Dec 2016 15:32:16 +0100 Subject: Exit on test failure When test fails, it should not continue to run other commands. Fixes #891 --- setuptools/command/test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/test.py b/setuptools/command/test.py index 9a5117be..60ba2354 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -226,12 +226,14 @@ class test(Command): list(map(sys.modules.__delitem__, del_modules)) exit_kwarg = {} if sys.version_info < (2, 7) else {"exit": False} - unittest_main( + test = unittest_main( None, None, self._argv, testLoader=self._resolve_as_ep(self.test_loader), testRunner=self._resolve_as_ep(self.test_runner), **exit_kwarg ) + if not test.result.wasSuccessful(): + sys.exit(1) @property def _argv(self): -- cgit v1.2.1 From 2c4fd43277fc477d85b50e15c37b176136676270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 16 Dec 2016 16:15:04 +0100 Subject: Raise DistutilsError and log result --- setuptools/command/test.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/test.py b/setuptools/command/test.py index 60ba2354..ef0af12f 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -3,7 +3,8 @@ import operator import sys import contextlib import itertools -from distutils.errors import DistutilsOptionError +from distutils.errors import DistutilsError, DistutilsOptionError +from distutils import log from unittest import TestLoader from setuptools.extern import six @@ -233,7 +234,9 @@ class test(Command): **exit_kwarg ) if not test.result.wasSuccessful(): - sys.exit(1) + msg = 'Test failed: %s' % test.result + self.announce(msg, log.ERROR) + raise DistutilsError(msg) @property def _argv(self): -- cgit v1.2.1 From 53e5575e11a35aaf761da56aa6728cdcd7c04ec0 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Dec 2016 08:38:56 -0500 Subject: When invoking rmtree, ensure the parameter is unicode to avoid errors when the tree contains Unicode filenames. Fixes #704. --- setuptools/command/easy_install.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'setuptools/command') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 03dd6768..7d982d89 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -666,6 +666,9 @@ class easy_install(Command): finally: if os.path.exists(tmpdir): + # workaround for http://bugs.python.org/issue24672 + if six.PY2: + tmpdir = six.u(tmpdir) rmtree(tmpdir) def install_item(self, spec, download, tmpdir, deps, install_needed=False): -- cgit v1.2.1 From 7f89e790d228aeece7df1fda8eb6c762d772c450 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Dec 2016 09:30:21 -0500 Subject: Can't use six.u as 'c:\users' triggers unicode_escape and fails. Ref #704. --- setuptools/command/easy_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 7d982d89..e3b7161a 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -668,7 +668,7 @@ class easy_install(Command): if os.path.exists(tmpdir): # workaround for http://bugs.python.org/issue24672 if six.PY2: - tmpdir = six.u(tmpdir) + tmpdir = tmpdir.decode('ascii') rmtree(tmpdir) def install_item(self, spec, download, tmpdir, deps, install_needed=False): -- cgit v1.2.1 From 674d5ecb1695de056226d1ad65c5d8b48ca99f3b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Dec 2016 09:45:13 -0500 Subject: Extract tmpdir as a context manager --- setuptools/command/easy_install.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index e3b7161a..b9d41cb0 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -627,12 +627,24 @@ class easy_install(Command): (spec.key, self.build_directory) ) - def easy_install(self, spec, deps=False): + @contextlib.contextmanager + def _tmpdir(self): tmpdir = tempfile.mkdtemp(prefix="easy_install-") + try: + yield tmpdir + finally: + if not os.path.exists(tmpdir): + return + # workaround for http://bugs.python.org/issue24672 + if six.PY2: + tmpdir = tmpdir.decode('ascii') + rmtree(tmpdir) + + def easy_install(self, spec, deps=False): if not self.editable: self.install_site_py() - try: + with self._tmpdir() as tmpdir: if not isinstance(spec, Requirement): if URL_SCHEME(spec): # It's a url, download it to tmpdir and process @@ -664,13 +676,6 @@ class easy_install(Command): else: return self.install_item(spec, dist.location, tmpdir, deps) - finally: - if os.path.exists(tmpdir): - # workaround for http://bugs.python.org/issue24672 - if six.PY2: - tmpdir = tmpdir.decode('ascii') - rmtree(tmpdir) - def install_item(self, spec, download, tmpdir, deps, install_needed=False): # Installation is also needed if file in tmpdir or is not an egg -- cgit v1.2.1 From 6c6f4caa4bacce4b719b1e03fb02fdb857b1a135 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Dec 2016 10:07:11 -0500 Subject: Move toward future compatibility using unicode strings, but cast to native str as workaround for #709, #710, and #712. --- setuptools/command/easy_install.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index b9d41cb0..14ad25c2 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -629,16 +629,12 @@ class easy_install(Command): @contextlib.contextmanager def _tmpdir(self): - tmpdir = tempfile.mkdtemp(prefix="easy_install-") + tmpdir = tempfile.mkdtemp(prefix=six.u("easy_install-")) try: - yield tmpdir + # cast to str as workaround for #709 and #710 and #712 + yield str(tmpdir) finally: - if not os.path.exists(tmpdir): - return - # workaround for http://bugs.python.org/issue24672 - if six.PY2: - tmpdir = tmpdir.decode('ascii') - rmtree(tmpdir) + os.path.exists(tmpdir) and rmtree(tmpdir) def easy_install(self, spec, deps=False): if not self.editable: -- cgit v1.2.1 From 5ad13718686bee04a93b4e86929c1bb170f14a52 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 21 Dec 2016 14:15:37 -0500 Subject: Cast the value to rmtree to bytes on Linux and Python 2 when the filesystemencoding is ascii, and let posixpath work its voodoo. Fixes #706. --- setuptools/command/easy_install.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 14ad25c2..36e7f359 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -46,6 +46,7 @@ from setuptools.extern.six.moves import configparser, map from setuptools import Command from setuptools.sandbox import run_setup from setuptools.py31compat import get_path, get_config_vars +from setuptools.py27compat import rmtree_safe from setuptools.command import setopt from setuptools.archive_util import unpack_archive from setuptools.package_index import ( @@ -634,7 +635,7 @@ class easy_install(Command): # cast to str as workaround for #709 and #710 and #712 yield str(tmpdir) finally: - os.path.exists(tmpdir) and rmtree(tmpdir) + os.path.exists(tmpdir) and rmtree(rmtree_safe(tmpdir)) def easy_install(self, spec, deps=False): if not self.editable: -- cgit v1.2.1 From 249f870f2c6fb60734e9db34e44f7e44cd35c914 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 1 Jan 2017 10:08:00 -0500 Subject: Drop support for 'tag_svn_version' distribution option. Fixes #619. --- setuptools/command/egg_info.py | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 6f8fd874..98a87300 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -32,11 +32,6 @@ from setuptools.glob import glob from pkg_resources.extern import packaging -try: - from setuptools_svn import svn_utils -except ImportError: - pass - def translate_pattern(glob): """ @@ -147,7 +142,6 @@ class egg_info(Command): self.egg_base = None self.egg_info = None self.tag_build = None - self.tag_svn_revision = 0 self.tag_date = 0 self.broken_egg_info = False self.vtags = None @@ -165,7 +159,6 @@ class egg_info(Command): # when PYTHONHASHSEED=0 egg_info['tag_build'] = self.tags() egg_info['tag_date'] = 0 - egg_info['tag_svn_revision'] = 0 edit_config(filename, dict(egg_info=egg_info)) def finalize_options(self): @@ -282,22 +275,10 @@ class egg_info(Command): version = '' if self.tag_build: version += self.tag_build - if self.tag_svn_revision: - warnings.warn( - "tag_svn_revision is deprecated and will not be honored " - "in a future release" - ) - version += '-r%s' % self.get_svn_revision() if self.tag_date: version += time.strftime("-%Y%m%d") return version - @staticmethod - def get_svn_revision(): - if 'svn_utils' not in globals(): - return "0" - return str(svn_utils.SvnInfo.load(os.curdir).get_revision()) - def find_sources(self): """Generate SOURCES.txt manifest file""" manifest_filename = os.path.join(self.egg_info, "SOURCES.txt") -- cgit v1.2.1 From ff371f18f0076bc63da05334f7e551c1cc29e10d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 1 Jan 2017 22:34:28 -0500 Subject: Strip out vendored packages and require them instead. Ref #581. --- setuptools/command/alias.py | 2 +- setuptools/command/bdist_egg.py | 2 +- setuptools/command/build_ext.py | 2 +- setuptools/command/build_py.py | 4 ++-- setuptools/command/develop.py | 2 +- setuptools/command/easy_install.py | 4 ++-- setuptools/command/egg_info.py | 6 +++--- setuptools/command/py36compat.py | 2 +- setuptools/command/rotate.py | 2 +- setuptools/command/sdist.py | 2 +- setuptools/command/setopt.py | 2 +- setuptools/command/test.py | 4 ++-- setuptools/command/upload_docs.py | 4 ++-- 13 files changed, 19 insertions(+), 19 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/alias.py b/setuptools/command/alias.py index 4532b1cc..35ece78d 100755 --- a/setuptools/command/alias.py +++ b/setuptools/command/alias.py @@ -1,6 +1,6 @@ from distutils.errors import DistutilsOptionError -from setuptools.extern.six.moves import map +from six.moves import map from setuptools.command.setopt import edit_config, option_base, config_file diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 8cd9dfef..ae344cd0 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -11,7 +11,7 @@ import os import textwrap import marshal -from setuptools.extern import six +import six from pkg_resources import get_build_platform, Distribution, ensure_directory from pkg_resources import EntryPoint diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index 36f53f0d..c2fd8704 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -10,7 +10,7 @@ from distutils.errors import DistutilsError from distutils import log from setuptools.extension import Library -from setuptools.extern import six +import six try: # Attempt to use Cython for building extensions, if available diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py index b0314fd4..56daa2bd 100644 --- a/setuptools/command/build_py.py +++ b/setuptools/command/build_py.py @@ -8,8 +8,8 @@ import io import distutils.errors import itertools -from setuptools.extern import six -from setuptools.extern.six.moves import map, filter, filterfalse +import six +from six.moves import map, filter, filterfalse try: from setuptools.lib2to3_ex import Mixin2to3 diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py index aa82f959..1489de9e 100755 --- a/setuptools/command/develop.py +++ b/setuptools/command/develop.py @@ -5,7 +5,7 @@ import os import glob import io -from setuptools.extern import six +import six from pkg_resources import Distribution, PathMetadata, normalize_path from setuptools.command.easy_install import easy_install diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 36e7f359..d3eabfc3 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -40,8 +40,8 @@ import subprocess import shlex import io -from setuptools.extern import six -from setuptools.extern.six.moves import configparser, map +import six +from six.moves import configparser, map from setuptools import Command from setuptools.sandbox import run_setup diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 98a87300..2bc57b18 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -16,8 +16,8 @@ import warnings import time import collections -from setuptools.extern import six -from setuptools.extern.six.moves import map +import six +from six.moves import map from setuptools import Command from setuptools.command.sdist import sdist @@ -30,7 +30,7 @@ from pkg_resources import ( import setuptools.unicode_utils as unicode_utils from setuptools.glob import glob -from pkg_resources.extern import packaging +import packaging def translate_pattern(glob): diff --git a/setuptools/command/py36compat.py b/setuptools/command/py36compat.py index 61063e75..a2c74b2d 100644 --- a/setuptools/command/py36compat.py +++ b/setuptools/command/py36compat.py @@ -3,7 +3,7 @@ from glob import glob from distutils.util import convert_path from distutils.command import sdist -from setuptools.extern.six.moves import filter +from six.moves import filter class sdist_add_defaults: diff --git a/setuptools/command/rotate.py b/setuptools/command/rotate.py index b89353f5..7ea36e96 100755 --- a/setuptools/command/rotate.py +++ b/setuptools/command/rotate.py @@ -4,7 +4,7 @@ from distutils.errors import DistutilsOptionError import os import shutil -from setuptools.extern import six +import six from setuptools import Command diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 84e29a1b..2c2d88af 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -5,7 +5,7 @@ import sys import io import contextlib -from setuptools.extern import six +import six from .py36compat import sdist_add_defaults diff --git a/setuptools/command/setopt.py b/setuptools/command/setopt.py index 7e57cc02..6f6298c4 100755 --- a/setuptools/command/setopt.py +++ b/setuptools/command/setopt.py @@ -4,7 +4,7 @@ from distutils.errors import DistutilsOptionError import distutils import os -from setuptools.extern.six.moves import configparser +from six.moves import configparser from setuptools import Command diff --git a/setuptools/command/test.py b/setuptools/command/test.py index ef0af12f..e7a386d1 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -7,8 +7,8 @@ from distutils.errors import DistutilsError, DistutilsOptionError from distutils import log from unittest import TestLoader -from setuptools.extern import six -from setuptools.extern.six.moves import map, filter +import six +from six.moves import map, filter from pkg_resources import (resource_listdir, resource_exists, normalize_path, working_set, _namespace_packages, diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index 269dc2d5..eeb0718b 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -16,8 +16,8 @@ import shutil import itertools import functools -from setuptools.extern import six -from setuptools.extern.six.moves import http_client, urllib +import six +from six.moves import http_client, urllib from pkg_resources import iter_entry_points from .upload import upload -- cgit v1.2.1 From dc8683bd8e8600680a7581fd3a2d34ba8f1fa0ab Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 2 Jan 2017 09:29:42 -0500 Subject: More aggressively remove references to 'tag_svn_revision' option in egg_info. Ref #619. --- setuptools/command/egg_info.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 98a87300..e3578074 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -121,18 +121,13 @@ class egg_info(Command): user_options = [ ('egg-base=', 'e', "directory containing .egg-info directories" " (default: top of the source tree)"), - ('tag-svn-revision', 'r', - "Add subversion revision ID to version number"), ('tag-date', 'd', "Add date stamp (e.g. 20050528) to version number"), ('tag-build=', 'b', "Specify explicit tag to add to version number"), - ('no-svn-revision', 'R', - "Don't add subversion revision ID [default]"), ('no-date', 'D', "Don't include date stamp [default]"), ] - boolean_options = ['tag-date', 'tag-svn-revision'] + boolean_options = ['tag-date'] negative_opt = { - 'no-svn-revision': 'tag-svn-revision', 'no-date': 'tag-date', } @@ -148,8 +143,8 @@ class egg_info(Command): def save_version_info(self, filename): """ - Materialize the values of svn_revision and date into the - build tag. Install these keys in a deterministic order + Materialize the value of date into the + build tag. Install build keys in a deterministic order to avoid arbitrary reordering on subsequent builds. """ # python 2.6 compatibility -- cgit v1.2.1 From b848627d17328cab9bdce4fabd314c76d5f7d96e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 2 Jan 2017 09:56:47 -0500 Subject: Add a no-op property for 'tag_svn_revision' to suppress errors when distutils attempts to detect and set these values based on settings in setup.cfg as found in sdists built by earlier versions of setuptools. Ref #619. --- setuptools/command/egg_info.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'setuptools/command') diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index e3578074..ca6a4348 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -141,6 +141,18 @@ class egg_info(Command): self.broken_egg_info = False self.vtags = None + #################################### + # allow the 'tag_svn_revision' to be detected and + # set, supporting sdists built on older Setuptools. + @property + def tag_svn_revision(self): + pass + + @tag_svn_revision.setter + def tag_svn_revision(self, value): + pass + #################################### + def save_version_info(self, filename): """ Materialize the value of date into the -- cgit v1.2.1 From e9f0e6f16b46d084bdf92606cd0217b3f12ed25a Mon Sep 17 00:00:00 2001 From: David Szotten Date: Thu, 5 Jan 2017 11:47:09 +0000 Subject: strip trailing slash from package_dir before counting slashes --- setuptools/command/develop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py index aa82f959..ca05d1e3 100755 --- a/setuptools/command/develop.py +++ b/setuptools/command/develop.py @@ -79,7 +79,7 @@ class develop(namespaces.DevelopInstaller, easy_install): project_name=ei.egg_name ) - p = self.egg_base.replace(os.sep, '/') + p = self.egg_base.replace(os.sep, '/').rstrip('/') if p != os.curdir: p = '../' * (p.count('/') + 1) self.setup_path = p -- cgit v1.2.1 From 9f440c3f7461e5c097705ca0823b316c0c11e2f9 Mon Sep 17 00:00:00 2001 From: Daniel Nunes Date: Thu, 19 Jan 2017 22:01:33 +0000 Subject: Added build_clib module and unit tests. Added rudimentary dependency system for build_libraries. Added obj_deps and cflags keys to build_info dictionary. --- setuptools/command/__init__.py | 2 +- setuptools/command/build_clib.py | 98 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 setuptools/command/build_clib.py (limited to 'setuptools/command') diff --git a/setuptools/command/__init__.py b/setuptools/command/__init__.py index efbe9411..c96d33c2 100644 --- a/setuptools/command/__init__.py +++ b/setuptools/command/__init__.py @@ -2,7 +2,7 @@ __all__ = [ 'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop', 'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts', 'sdist', 'setopt', 'test', 'install_egg_info', 'install_scripts', - 'register', 'bdist_wininst', 'upload_docs', 'upload', + 'register', 'bdist_wininst', 'upload_docs', 'upload', 'build_clib', ] from distutils.command.bdist import bdist diff --git a/setuptools/command/build_clib.py b/setuptools/command/build_clib.py new file mode 100644 index 00000000..09caff6f --- /dev/null +++ b/setuptools/command/build_clib.py @@ -0,0 +1,98 @@ +import distutils.command.build_clib as orig +from distutils.errors import DistutilsSetupError +from distutils import log +from setuptools.dep_util import newer_pairwise_group + + +class build_clib(orig.build_clib): + """ + Override the default build_clib behaviour to do the following: + + 1. Implement a rudimentary timestamp-based dependency system + so 'compile()' doesn't run every time. + 2. Add more keys to the 'build_info' dictionary: + * obj_deps - specify dependencies for each object compiled. + this should be a dictionary mapping a key + with the source filename to a list of + dependencies. Use an empty string for global + dependencies. + * cflags - specify a list of additional flags to pass to + the compiler. + """ + + def build_libraries(self, libraries): + for (lib_name, build_info) in libraries: + sources = build_info.get('sources') + if sources is None or not isinstance(sources, (list, tuple)): + raise DistutilsSetupError( + "in 'libraries' option (library '%s'), " + "'sources' must be present and must be " + "a list of source filenames" % lib_name) + sources = list(sources) + + log.info("building '%s' library", lib_name) + + # Make sure everything is the correct type. + # obj_deps should be a dictionary of keys as sources + # and a list/tuple of files that are its dependencies. + obj_deps = build_info.get('obj_deps', dict()) + if not isinstance(obj_deps, dict): + raise DistutilsSetupError( + "in 'libraries' option (library '%s'), " + "'obj_deps' must be a dictionary of " + "type 'source: list'" % lib_name) + dependencies = [] + + # Get the global dependencies that are specified by the '' key. + # These will go into every source's dependency list. + global_deps = obj_deps.get('', list()) + if not isinstance(global_deps, (list, tuple)): + raise DistutilsSetupError( + "in 'libraries' option (library '%s'), " + "'obj_deps' must be a dictionary of " + "type 'source: list'" % lib_name) + + # Build the list to be used by newer_pairwise_group + # each source will be auto-added to its dependencies. + for source in sources: + src_deps = [source] + src_deps.extend(global_deps) + extra_deps = obj_deps.get(source, list()) + if not isinstance(extra_deps, (list, tuple)): + raise DistutilsSetupError( + "in 'libraries' option (library '%s'), " + "'obj_deps' must be a dictionary of " + "type 'source: list'" % lib_name) + src_deps.extend(extra_deps) + dependencies.append(src_deps) + + expected_objects = self.compiler.object_filenames( + sources, + output_dir=self.build_temp + ) + + if newer_pairwise_group(dependencies, expected_objects) != ([], []): + # First, compile the source code to object files in the library + # directory. (This should probably change to putting object + # files in a temporary build directory.) + macros = build_info.get('macros') + include_dirs = build_info.get('include_dirs') + cflags = build_info.get('cflags') + objects = self.compiler.compile( + sources, + output_dir=self.build_temp, + macros=macros, + include_dirs=include_dirs, + extra_postargs=cflags, + debug=self.debug + ) + + # Now "link" the object files together into a static library. + # (On Unix at least, this isn't really linking -- it just + # builds an archive. Whatever.) + self.compiler.create_static_lib( + expected_objects, + lib_name, + output_dir=self.build_clib, + debug=self.debug + ) -- cgit v1.2.1 From 56274b32724933cd2016488c4e667e86d30572ef Mon Sep 17 00:00:00 2001 From: Hatem Nassrat Date: Mon, 23 Jan 2017 18:07:21 +0000 Subject: fixes #935 - allows for glob syntax in graft --- setuptools/command/egg_info.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 5ab54dc7..62bf00aa 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -429,7 +429,9 @@ class FileList(_FileList): def graft(self, dir): """Include all files from 'dir/'.""" - found = distutils.filelist.findall(dir) + found = [] + for match_dir in glob(dir): + found += distutils.filelist.findall(match_dir) self.extend(found) return bool(found) -- cgit v1.2.1 From 9cb83c3711d737fa3bff56f55e4def8267bae83c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 23 Jan 2017 17:01:33 -0500 Subject: Prefer list comprehension to init/append loop. Ref #936. --- setuptools/command/egg_info.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 62bf00aa..1a6ea9cb 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -429,9 +429,11 @@ class FileList(_FileList): def graft(self, dir): """Include all files from 'dir/'.""" - found = [] - for match_dir in glob(dir): - found += distutils.filelist.findall(match_dir) + found = [ + item + for match_dir in glob(dir) + for item in distutils.filelist.findall(match_dir) + ] self.extend(found) return bool(found) -- cgit v1.2.1 From 322472e4ffdc03901be1f584a548b00f1372037d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 24 Jan 2017 10:13:24 -0500 Subject: Extract staticmethod for resolving setup path --- setuptools/command/develop.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py index 1489de9e..97708ba3 100755 --- a/setuptools/command/develop.py +++ b/setuptools/command/develop.py @@ -79,15 +79,28 @@ class develop(namespaces.DevelopInstaller, easy_install): project_name=ei.egg_name ) - p = self.egg_base.replace(os.sep, '/') - if p != os.curdir: - p = '../' * (p.count('/') + 1) - self.setup_path = p - p = normalize_path(os.path.join(self.install_dir, self.egg_path, p)) - if p != normalize_path(os.curdir): + self.setup_path = self._resolve_setup_path( + self.egg_base, + self.install_dir, + self.egg_path, + ) + + @staticmethod + def _resolve_setup_path(egg_base, install_dir, egg_path): + """ + Generate a path from egg_base back to '.' where the + setup script resides and ensure that path points to the + setup path from $install_dir/$egg_path. + """ + path_to_setup = egg_base.replace(os.sep, '/') + if path_to_setup != os.curdir: + path_to_setup = '../' * (path_to_setup.count('/') + 1) + resolved = normalize_path(os.path.join(install_dir, egg_path, path_to_setup)) + if resolved != normalize_path(os.curdir): raise DistutilsOptionError( "Can't get a consistent path to setup script from" - " installation directory", p, normalize_path(os.curdir)) + " installation directory", resolved, normalize_path(os.curdir)) + return path_to_setup def install_for_development(self): if six.PY3 and getattr(self.distribution, 'use_2to3', False): -- cgit v1.2.1 From ed360af83a547d565aea8c20d3086486c4c9491c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 2 Feb 2017 09:00:35 -0500 Subject: Infer the username using getpass.getuser() if no username is resolved from .pypirc. --- setuptools/command/upload.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'setuptools/command') diff --git a/setuptools/command/upload.py b/setuptools/command/upload.py index 484baa5a..a44173a9 100644 --- a/setuptools/command/upload.py +++ b/setuptools/command/upload.py @@ -10,6 +10,10 @@ class upload(orig.upload): def finalize_options(self): orig.upload.finalize_options(self) + self.username = ( + self.username or + getpass.getuser() + ) # Attempt to obtain password. Short circuit evaluation at the first # sign of success. self.password = ( -- cgit v1.2.1 From 3d0cc355fb5e8012cb8c72f0e25042a5a44f31d6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 24 Feb 2017 11:49:51 -0500 Subject: Revert "Merge pull request #933 from pypa/feature/581-depend-not-bundle" This reverts commit 089cdeb489a0fa94d11b7307b54210ef9aa40511, reversing changes made to aaec654d804cb78dbb6391afff721a63f26a71cd. --- setuptools/command/alias.py | 2 +- setuptools/command/bdist_egg.py | 2 +- setuptools/command/build_ext.py | 2 +- setuptools/command/build_py.py | 4 ++-- setuptools/command/develop.py | 2 +- setuptools/command/easy_install.py | 4 ++-- setuptools/command/egg_info.py | 6 +++--- setuptools/command/py36compat.py | 2 +- setuptools/command/rotate.py | 2 +- setuptools/command/sdist.py | 2 +- setuptools/command/setopt.py | 2 +- setuptools/command/test.py | 4 ++-- setuptools/command/upload_docs.py | 4 ++-- 13 files changed, 19 insertions(+), 19 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/alias.py b/setuptools/command/alias.py index 35ece78d..4532b1cc 100755 --- a/setuptools/command/alias.py +++ b/setuptools/command/alias.py @@ -1,6 +1,6 @@ from distutils.errors import DistutilsOptionError -from six.moves import map +from setuptools.extern.six.moves import map from setuptools.command.setopt import edit_config, option_base, config_file diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index ae344cd0..8cd9dfef 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -11,7 +11,7 @@ import os import textwrap import marshal -import six +from setuptools.extern import six from pkg_resources import get_build_platform, Distribution, ensure_directory from pkg_resources import EntryPoint diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index c2fd8704..36f53f0d 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -10,7 +10,7 @@ from distutils.errors import DistutilsError from distutils import log from setuptools.extension import Library -import six +from setuptools.extern import six try: # Attempt to use Cython for building extensions, if available diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py index 56daa2bd..b0314fd4 100644 --- a/setuptools/command/build_py.py +++ b/setuptools/command/build_py.py @@ -8,8 +8,8 @@ import io import distutils.errors import itertools -import six -from six.moves import map, filter, filterfalse +from setuptools.extern import six +from setuptools.extern.six.moves import map, filter, filterfalse try: from setuptools.lib2to3_ex import Mixin2to3 diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py index ddfdc662..85b23c60 100755 --- a/setuptools/command/develop.py +++ b/setuptools/command/develop.py @@ -5,7 +5,7 @@ import os import glob import io -import six +from setuptools.extern import six from pkg_resources import Distribution, PathMetadata, normalize_path from setuptools.command.easy_install import easy_install diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index d3eabfc3..36e7f359 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -40,8 +40,8 @@ import subprocess import shlex import io -import six -from six.moves import configparser, map +from setuptools.extern import six +from setuptools.extern.six.moves import configparser, map from setuptools import Command from setuptools.sandbox import run_setup diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 1a6ea9cb..a32c42f8 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -16,8 +16,8 @@ import warnings import time import collections -import six -from six.moves import map +from setuptools.extern import six +from setuptools.extern.six.moves import map from setuptools import Command from setuptools.command.sdist import sdist @@ -30,7 +30,7 @@ from pkg_resources import ( import setuptools.unicode_utils as unicode_utils from setuptools.glob import glob -import packaging +from pkg_resources.extern import packaging def translate_pattern(glob): diff --git a/setuptools/command/py36compat.py b/setuptools/command/py36compat.py index a2c74b2d..61063e75 100644 --- a/setuptools/command/py36compat.py +++ b/setuptools/command/py36compat.py @@ -3,7 +3,7 @@ from glob import glob from distutils.util import convert_path from distutils.command import sdist -from six.moves import filter +from setuptools.extern.six.moves import filter class sdist_add_defaults: diff --git a/setuptools/command/rotate.py b/setuptools/command/rotate.py index 7ea36e96..b89353f5 100755 --- a/setuptools/command/rotate.py +++ b/setuptools/command/rotate.py @@ -4,7 +4,7 @@ from distutils.errors import DistutilsOptionError import os import shutil -import six +from setuptools.extern import six from setuptools import Command diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 2c2d88af..84e29a1b 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -5,7 +5,7 @@ import sys import io import contextlib -import six +from setuptools.extern import six from .py36compat import sdist_add_defaults diff --git a/setuptools/command/setopt.py b/setuptools/command/setopt.py index 6f6298c4..7e57cc02 100755 --- a/setuptools/command/setopt.py +++ b/setuptools/command/setopt.py @@ -4,7 +4,7 @@ from distutils.errors import DistutilsOptionError import distutils import os -from six.moves import configparser +from setuptools.extern.six.moves import configparser from setuptools import Command diff --git a/setuptools/command/test.py b/setuptools/command/test.py index e7a386d1..ef0af12f 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -7,8 +7,8 @@ from distutils.errors import DistutilsError, DistutilsOptionError from distutils import log from unittest import TestLoader -import six -from six.moves import map, filter +from setuptools.extern import six +from setuptools.extern.six.moves import map, filter from pkg_resources import (resource_listdir, resource_exists, normalize_path, working_set, _namespace_packages, diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index eeb0718b..269dc2d5 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -16,8 +16,8 @@ import shutil import itertools import functools -import six -from six.moves import http_client, urllib +from setuptools.extern import six +from setuptools.extern.six.moves import http_client, urllib from pkg_resources import iter_entry_points from .upload import upload -- cgit v1.2.1 From e753cb42481783ac858ceb518aaac1472075063c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 24 Feb 2017 10:55:44 +0200 Subject: Python 3.6 invalid escape sequence deprecation fixes --- setuptools/command/easy_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index d3eabfc3..f5ca0754 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -2013,7 +2013,7 @@ class ScriptWriter(object): gui apps. """ - template = textwrap.dedent(""" + template = textwrap.dedent(r""" # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r __requires__ = %(spec)r import re -- cgit v1.2.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(-) (limited to 'setuptools/command') 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 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 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/command') 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): -- 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(-) (limited to 'setuptools/command') 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 fe3deeeebd6d5f01e803ea6bbfcf001834ca45b7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 10 Apr 2017 11:13:51 -0400 Subject: Nicer syntax for processing PYTHONPATH --- setuptools/command/easy_install.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'setuptools/command') 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(-) (limited to 'setuptools/command') 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 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(-) (limited to 'setuptools/command') 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 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(+) (limited to 'setuptools/command') 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 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 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setuptools/command') 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): -- 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(-) (limited to 'setuptools/command') 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 995d309317c6895a123c03df28bc8f51f6ead5f5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 6 Jun 2017 17:04:45 -0400 Subject: Limit the scope of deprecation of the upload_docs command. --- setuptools/command/upload_docs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index 24a017cf..07aa564a 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -57,7 +57,6 @@ class upload_docs(upload): self.target_dir = None def finalize_options(self): - log.warn("Upload_docs command is deprecated. Use RTD instead.") upload.finalize_options(self) if self.upload_dir is None: if self.has_sphinx(): @@ -69,6 +68,8 @@ class upload_docs(upload): else: self.ensure_dirname('upload_dir') self.target_dir = self.upload_dir + if 'pypi.python.org' in self.repository: + log.warn("Upload_docs command is deprecated. Use RTD instead.") self.announce('Using upload directory %s' % self.target_dir) def create_zipfile(self, filename): -- cgit v1.2.1 From 04a306fa080e8a71f94ea5198b507c501c621cb6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 13 Jul 2017 14:13:54 -0400 Subject: Use makedirs with future compatibility throughout setuptools. Ref #1083. --- setuptools/command/easy_install.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index e319f77c..8fba7b41 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -59,7 +59,7 @@ from pkg_resources import ( Distribution, PathMetadata, EggMetadata, WorkingSet, DistributionNotFound, VersionConflict, DEVELOP_DIST, ) -import pkg_resources +import pkg_resources.py31compat # Turn on PEP440Warnings warnings.filterwarnings("default", category=pkg_resources.PEP440Warning) @@ -544,8 +544,7 @@ class easy_install(Command): if ok_exists: os.unlink(ok_file) dirname = os.path.dirname(ok_file) - if not os.path.exists(dirname): - os.makedirs(dirname) + pkg_resources.py31compat.makedirs(dirname, exist_ok=True) f = open(pth_file, 'w') except (OSError, IOError): self.cant_write_to_target() -- cgit v1.2.1 From 75e88f63cc0308f7933e936b171f9cba2d04e7ad Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Fri, 21 Jul 2017 16:39:15 +0200 Subject: fix `test` command handling of `extras_require` Also install platform specific requirements in `extras_require`. --- setuptools/command/test.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/test.py b/setuptools/command/test.py index b8863fdc..638d0c56 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -11,7 +11,7 @@ from setuptools.extern import six from setuptools.extern.six.moves import map, filter from pkg_resources import (resource_listdir, resource_exists, normalize_path, - working_set, _namespace_packages, + working_set, _namespace_packages, evaluate_marker, add_activation_listener, require, EntryPoint) from setuptools import Command from setuptools.py31compat import unittest_main @@ -191,9 +191,13 @@ class test(Command): Install the requirements indicated by self.distribution and return an iterable of the dists that were built. """ - ir_d = dist.fetch_build_eggs(dist.install_requires or []) + ir_d = dist.fetch_build_eggs(dist.install_requires) tr_d = dist.fetch_build_eggs(dist.tests_require or []) - return itertools.chain(ir_d, tr_d) + er_d = dist.fetch_build_eggs( + v for k, v in dist.extras_require.items() + if k.startswith(':') and evaluate_marker(k[1:]) + ) + return itertools.chain(ir_d, tr_d, er_d) def run(self): installed_dists = self.install_dists(self.distribution) -- cgit v1.2.1 From 29688821b381268a0d59c0d26317d88ad518f966 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Wed, 21 Jun 2017 14:08:35 +0200 Subject: Sort file lists to generate reproducible zip files that do not differ depending on (random) filesystem order See https://reproducible-builds.org/ for why this matters. --- setuptools/command/bdist_egg.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 8cd9dfef..51755d52 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -38,6 +38,14 @@ def strip_module(filename): filename = filename[:-6] return filename +def sorted_walk(dir): + """Do os.walk in a reproducible way, + independent of indeterministic filesystem readdir order + """ + for base, dirs, files in os.walk(dir): + dirs.sort() + files.sort() + yield base, dirs, files def write_stub(resource, pyfile): _stub_template = textwrap.dedent(""" @@ -302,7 +310,7 @@ class bdist_egg(Command): ext_outputs = [] paths = {self.bdist_dir: ''} - for base, dirs, files in os.walk(self.bdist_dir): + for base, dirs, files in sorted_walk(self.bdist_dir): for filename in files: if os.path.splitext(filename)[1].lower() in NATIVE_EXTENSIONS: all_outputs.append(paths[base] + filename) @@ -329,7 +337,7 @@ NATIVE_EXTENSIONS = dict.fromkeys('.dll .so .dylib .pyd'.split()) def walk_egg(egg_dir): """Walk an unpacked egg's contents, skipping the metadata directory""" - walker = os.walk(egg_dir) + walker = sorted_walk(egg_dir) base, dirs, files = next(walker) if 'EGG-INFO' in dirs: dirs.remove('EGG-INFO') @@ -463,10 +471,10 @@ def make_zipfile(zip_filename, base_dir, verbose=0, dry_run=0, compress=True, compression = zipfile.ZIP_DEFLATED if compress else zipfile.ZIP_STORED if not dry_run: z = zipfile.ZipFile(zip_filename, mode, compression=compression) - for dirname, dirs, files in os.walk(base_dir): + for dirname, dirs, files in sorted_walk(base_dir): visit(z, dirname, files) z.close() else: - for dirname, dirs, files in os.walk(base_dir): + for dirname, dirs, files in sorted_walk(base_dir): visit(None, dirname, files) return zip_filename -- cgit v1.2.1 From 4fc60ed1e47f725a833dd63656ceec981a58e1a0 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Sat, 30 Jul 2016 08:15:53 -0700 Subject: Add new long_description_content_type kwarg This is used to populate the new `Description-Content-Type` field. `Description-Content-Type` is described at https://github.com/pypa/python-packaging-user-guide/pull/258 --- setuptools/command/egg_info.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'setuptools/command') diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 6c00b0b7..a183d15d 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -599,6 +599,10 @@ def write_pkg_info(cmd, basename, filename): metadata = cmd.distribution.metadata metadata.version, oldver = cmd.egg_version, metadata.version metadata.name, oldname = cmd.egg_name, metadata.name + metadata.long_description_content_type = getattr( + cmd.distribution, + 'long_description_content_type' + ) try: # write unescaped data to PKG-INFO, so older pkg_resources # can still parse it -- cgit v1.2.1 From 500bb9a161e810523c48825491b853c5fbe595cc Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Tue, 22 Aug 2017 00:22:54 +0200 Subject: Improve README file list handling and add Markdown to the current list Markdown is a widely used format to write README files and documentation. This patch aims to simplify adding new formats and at the same time adds that one to the list. --- setuptools/command/sdist.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 84e29a1b..7b4d197d 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -37,7 +37,8 @@ class sdist(sdist_add_defaults, orig.sdist): negative_opt = {} - READMES = 'README', 'README.rst', 'README.txt' + README_EXTENSIONS = ['', '.rst', '.txt', '.md'] + READMES = tuple('README{}'.format(ext) for ext in README_EXTENSIONS) def run(self): self.run_command('egg_info') -- cgit v1.2.1 From e909e1cb7aff16a02a965fe3ebaa16a65d749d63 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Sun, 3 Sep 2017 20:10:22 +0200 Subject: Fix Python 2.6 support --- setuptools/command/sdist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 7b4d197d..508148e0 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -38,7 +38,7 @@ class sdist(sdist_add_defaults, orig.sdist): negative_opt = {} README_EXTENSIONS = ['', '.rst', '.txt', '.md'] - READMES = tuple('README{}'.format(ext) for ext in README_EXTENSIONS) + READMES = tuple('README{0}'.format(ext) for ext in README_EXTENSIONS) def run(self): self.run_command('egg_info') -- cgit v1.2.1