aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.hgtags2
-rw-r--r--CHANGES.rst14
-rwxr-xr-xpytest.ini3
-rwxr-xr-xsetup.cfg2
-rwxr-xr-xsetup.py5
-rwxr-xr-xsetuptools/command/sdist.py27
-rw-r--r--setuptools/dist.py39
-rw-r--r--setuptools/lib2to3_ex.py1
-rw-r--r--setuptools/msvc.py1
-rw-r--r--setuptools/tests/test_bdist_egg.py2
-rw-r--r--setuptools/tests/test_egg_info.py6
11 files changed, 96 insertions, 6 deletions
diff --git a/.hgtags b/.hgtags
index 85c47bdb..53264d85 100644
--- a/.hgtags
+++ b/.hgtags
@@ -284,3 +284,5 @@ d425bd1ee620772fe90e0dd2a7530b0d6a642601 v24.0.3
a7d2f79f0996d881794af0f87595032098202811 v24.1.0
d29075e7f8797891e8c59fb58c4d8d1b79954b34 v24.1.1
ed9e7bd8caf95261d528ee3db117611dc42814eb v24.2.0
+5b577d179a7e2f3020712c376c0200901e5c93c1 v24.2.1
+83ca05973c16102145b339aec7e170d94966a2ba v24.3.0
diff --git a/CHANGES.rst b/CHANGES.rst
index 28924a97..b01a6fad 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -2,6 +2,20 @@
CHANGES
=======
+v24.3.0
+-------
+
+* #516: Disable ``os.link`` to avoid hard linking
+ in ``sdist.make_distribution``, avoiding errors on
+ systems that support hard links but not on the
+ file system in which the build is occurring.
+
+v24.2.1
+-------
+
+* #667: Update Metadata-Version to 1.2 when
+ ``python_requires`` is supplied.
+
v24.2.0
-------
diff --git a/pytest.ini b/pytest.ini
index 2fa3a3ec..c693a4c3 100755
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,3 +1,6 @@
[pytest]
addopts=--doctest-modules --ignore release.py --ignore setuptools/lib2to3_ex.py --ignore tests/manual_test.py --ignore tests/shlib_test --doctest-glob=pkg_resources/api_tests.txt --ignore scripts/upload-old-releases-as-zip.py --ignore pavement.py
norecursedirs=dist build *.egg setuptools/extern pkg_resources/extern
+flake8-ignore =
+ setuptools/site-patch.py F821
+ setuptools/py*compat.py F811
diff --git a/setup.cfg b/setup.cfg
index f94f03c8..50dee23b 100755
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 24.2.0
+current_version = 24.3.0
commit = True
tag = True
diff --git a/setup.py b/setup.py
index 7bd3a079..d05ec741 100755
--- a/setup.py
+++ b/setup.py
@@ -73,7 +73,7 @@ wheel = ['wheel'] if needs_wheel else []
setup_params = dict(
name="setuptools",
- version="24.2.0",
+ version="24.3.0",
description="Easily download, build, install, upgrade, and uninstall "
"Python packages",
author="Python Packaging Authority",
@@ -161,6 +161,9 @@ setup_params = dict(
scripts=[],
tests_require=[
'setuptools[ssl]',
+ 'pytest-flake8',
+ # workaround for pytest-flake8 #7
+ 'flake8<3dev',
'pytest>=2.8',
] + (['mock'] if sys.version_info[:2] < (3, 3) else []),
setup_requires=[
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index 041ee42e..b86aae50 100755
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -4,6 +4,7 @@ import distutils.command.sdist as orig
import os
import sys
import io
+import contextlib
from setuptools.extern import six
@@ -65,6 +66,32 @@ class sdist(orig.sdist):
if data not in dist_files:
dist_files.append(data)
+ def make_distribution(self):
+ """
+ Workaround for #516
+ """
+ with self._remove_os_link():
+ orig.sdist.make_distribution(self)
+
+ @staticmethod
+ @contextlib.contextmanager
+ def _remove_os_link():
+ """
+ In a context, remove and restore os.link if it exists
+ """
+ class NoValue:
+ pass
+ orig_val = getattr(os, 'link', NoValue)
+ try:
+ del os.link
+ except Exception:
+ pass
+ try:
+ yield
+ finally:
+ if orig_val is not NoValue:
+ setattr(os, 'link', orig_val)
+
def __read_template_hack(self):
# This grody hack closes the template file (MANIFEST.in) if an
# exception occurs during read_template.
diff --git a/setuptools/dist.py b/setuptools/dist.py
index c539f6ef..820df6d5 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -12,6 +12,7 @@ import distutils.dist
from distutils.core import Distribution as _Distribution
from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
DistutilsSetupError)
+from distutils.util import rfc822_escape
from setuptools.extern import six
from setuptools.extern.six.moves import map
@@ -42,12 +43,46 @@ _Distribution = _get_unpatched(_Distribution)
def _patch_distribution_metadata_write_pkg_file():
"""Patch write_pkg_file to also write Requires-Python/Requires-External"""
- original_write = distutils.dist.DistributionMetadata.write_pkg_file
+ # Based on Python 3.5 version
def write_pkg_file(self, file):
"""Write the PKG-INFO format data to a file object.
"""
- original_write(self, file)
+ version = '1.0'
+ if (self.provides or self.requires or self.obsoletes or
+ self.classifiers or self.download_url):
+ version = '1.1'
+ # Setuptools specific for PEP 345
+ if hasattr(self, 'python_requires'):
+ version = '1.2'
+
+ file.write('Metadata-Version: %s\n' % version)
+ file.write('Name: %s\n' % self.get_name())
+ file.write('Version: %s\n' % self.get_version())
+ file.write('Summary: %s\n' % self.get_description())
+ file.write('Home-page: %s\n' % self.get_url())
+ file.write('Author: %s\n' % self.get_contact())
+ file.write('Author-email: %s\n' % self.get_contact_email())
+ file.write('License: %s\n' % self.get_license())
+ if self.download_url:
+ file.write('Download-URL: %s\n' % self.download_url)
+
+ long_desc = rfc822_escape(self.get_long_description())
+ file.write('Description: %s\n' % long_desc)
+
+ keywords = ','.join(self.get_keywords())
+ if keywords:
+ file.write('Keywords: %s\n' % keywords)
+
+ self._write_list(file, 'Platform', self.get_platforms())
+ self._write_list(file, 'Classifier', self.get_classifiers())
+
+ # PEP 314
+ self._write_list(file, 'Requires', self.get_requires())
+ self._write_list(file, 'Provides', self.get_provides())
+ self._write_list(file, 'Obsoletes', self.get_obsoletes())
+
+ # Setuptools specific for PEP 345
if hasattr(self, 'python_requires'):
file.write('Requires-Python: %s\n' % self.python_requires)
diff --git a/setuptools/lib2to3_ex.py b/setuptools/lib2to3_ex.py
index 467e57d2..c8632bc5 100644
--- a/setuptools/lib2to3_ex.py
+++ b/setuptools/lib2to3_ex.py
@@ -10,6 +10,7 @@ This module raises an ImportError on Python 2.
from distutils.util import Mixin2to3 as _Mixin2to3
from distutils import log
from lib2to3.refactor import RefactoringTool, get_fixers_from_package
+
import setuptools
diff --git a/setuptools/msvc.py b/setuptools/msvc.py
index 012ab32c..2a665c92 100644
--- a/setuptools/msvc.py
+++ b/setuptools/msvc.py
@@ -5,6 +5,7 @@ import os
import platform
import itertools
import distutils.errors
+
from setuptools.extern.six.moves import filterfalse
if platform.system() == 'Windows':
diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index 5aabf404..c77aa226 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -9,6 +9,7 @@ from setuptools.dist import Distribution
from . import contexts
+
SETUP_PY = """\
from setuptools import setup
@@ -27,6 +28,7 @@ def setup_context(tmpdir):
class Test:
+
def test_bdist_egg(self, setup_context, user_override):
dist = Distribution(dict(
script_name='setup.py',
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 0b9da538..dff2a8c8 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -223,8 +223,10 @@ class TestEggInfo(object):
env=environ,
)
egg_info_dir = os.path.join('.', 'foo.egg-info')
- pkginfo = os.path.join(egg_info_dir, 'PKG-INFO')
- assert 'Requires-Python: >=2.7.12' in open(pkginfo).read().split('\n')
+ with open(os.path.join(egg_info_dir, 'PKG-INFO')) as pkginfo_file:
+ pkg_info_lines = pkginfo_file.read().split('\n')
+ assert 'Requires-Python: >=2.7.12' in pkg_info_lines
+ assert 'Metadata-Version: 1.2' in pkg_info_lines
def test_python_requires_install(self, tmpdir_cwd, env):
self._setup_script_with_requires(