summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/main.yml34
-rw-r--r--changelog.d/2866.change.rst1
-rw-r--r--setuptools/_distutils/ccompiler.py2
-rw-r--r--setuptools/_distutils/command/install.py26
-rw-r--r--setuptools/_distutils/tests/test_unixccompiler.py7
5 files changed, 60 insertions, 10 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index a82b6fd2..41490892 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -35,6 +35,40 @@ jobs:
${{ runner.os }},
${{ matrix.python }}
+ ci_setuptools:
+ # Integration testing with setuptools
+ strategy:
+ matrix:
+ python: [3.9]
+ platform: [ubuntu-latest]
+ runs-on: ${{ matrix.platform }}
+ env:
+ SETUPTOOLS_USE_DISTUTILS: local
+ steps:
+ - uses: actions/checkout@v2
+ - name: Setup Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python }}
+ - name: Install tox
+ run: |
+ python -m pip install tox
+ - name: Check out pypa/setuptools
+ uses: actions/checkout@v2
+ with:
+ repository: pypa/setuptools
+ ref: main
+ path: integration/setuptools
+ - name: Replace vendored distutils
+ run: |
+ cd integration/setuptools/setuptools
+ rm -rf _distutils
+ cp -rp ../../../distutils _distutils
+ - name: Run setuptools tests
+ run: |
+ cd integration/setuptools
+ tox
+
release:
needs: test
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
diff --git a/changelog.d/2866.change.rst b/changelog.d/2866.change.rst
new file mode 100644
index 00000000..c6929d86
--- /dev/null
+++ b/changelog.d/2866.change.rst
@@ -0,0 +1 @@
+Incorporate changes from pypa/distutils@f1b0a2b.
diff --git a/setuptools/_distutils/ccompiler.py b/setuptools/_distutils/ccompiler.py
index 48d160d2..777fc661 100644
--- a/setuptools/_distutils/ccompiler.py
+++ b/setuptools/_distutils/ccompiler.py
@@ -802,7 +802,7 @@ int main (int argc, char **argv) {
except (LinkError, TypeError):
return False
else:
- os.remove("a.out")
+ os.remove(os.path.join(self.output_dir or '', "a.out"))
finally:
for fn in objects:
os.remove(fn)
diff --git a/setuptools/_distutils/command/install.py b/setuptools/_distutils/command/install.py
index 866e2d59..e98f0491 100644
--- a/setuptools/_distutils/command/install.py
+++ b/setuptools/_distutils/command/install.py
@@ -29,16 +29,16 @@ WINDOWS_SCHEME = {
INSTALL_SCHEMES = {
'unix_prefix': {
- 'purelib': '$base/lib/python$py_version_short/site-packages',
- 'platlib': '$platbase/$platlibdir/python$py_version_short/site-packages',
- 'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
+ 'purelib': '$base/lib/$implementation_lower$py_version_short/site-packages',
+ 'platlib': '$platbase/$platlibdir/$implementation_lower$py_version_short/site-packages',
+ 'headers': '$base/include/$implementation_lower$py_version_short$abiflags/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
},
'unix_home': {
- 'purelib': '$base/lib/python',
- 'platlib': '$base/$platlibdir/python',
- 'headers': '$base/include/python/$dist_name',
+ 'purelib': '$base/lib/$implementation_lower',
+ 'platlib': '$base/$platlibdir/$implementation_lower',
+ 'headers': '$base/include/$implementation_lower/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
},
@@ -64,8 +64,8 @@ if HAS_USER_SITE:
INSTALL_SCHEMES['nt_user'] = {
'purelib': '$usersite',
'platlib': '$usersite',
- 'headers': '$userbase/Python$py_version_nodot/Include/$dist_name',
- 'scripts': '$userbase/Python$py_version_nodot/Scripts',
+ 'headers': '$userbase/$implementation$py_version_nodot/Include/$dist_name',
+ 'scripts': '$userbase/$implementation$py_version_nodot/Scripts',
'data' : '$userbase',
}
@@ -73,7 +73,7 @@ if HAS_USER_SITE:
'purelib': '$usersite',
'platlib': '$usersite',
'headers':
- '$userbase/include/python$py_version_short$abiflags/$dist_name',
+ '$userbase/include/$implementation_lower$py_version_short$abiflags/$dist_name',
'scripts': '$userbase/bin',
'data' : '$userbase',
}
@@ -83,6 +83,12 @@ if HAS_USER_SITE:
# and to SCHEME_KEYS here.
SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')
+def _get_implementation():
+ if hasattr(sys, 'pypy_version_info'):
+ return 'PyPy'
+ else:
+ return 'Python'
+
class install(Command):
@@ -313,6 +319,8 @@ class install(Command):
'exec_prefix': exec_prefix,
'abiflags': abiflags,
'platlibdir': getattr(sys, 'platlibdir', 'lib'),
+ 'implementation_lower': _get_implementation().lower(),
+ 'implementation': _get_implementation(),
}
if HAS_USER_SITE:
diff --git a/setuptools/_distutils/tests/test_unixccompiler.py b/setuptools/_distutils/tests/test_unixccompiler.py
index ee2fe99c..63c7dd37 100644
--- a/setuptools/_distutils/tests/test_unixccompiler.py
+++ b/setuptools/_distutils/tests/test_unixccompiler.py
@@ -232,6 +232,13 @@ class UnixCCompilerTestCase(unittest.TestCase):
sysconfig.customize_compiler(self.cc)
self.assertEqual(self.cc.linker_so[0], 'my_ld')
+ def test_has_function(self):
+ # Issue https://github.com/pypa/distutils/issues/64:
+ # ensure that setting output_dir does not raise
+ # FileNotFoundError: [Errno 2] No such file or directory: 'a.out'
+ self.cc.output_dir = 'scratch'
+ self.cc.has_function('abort', includes=['stdlib.h'])
+
def test_suite():
return unittest.makeSuite(UnixCCompilerTestCase)