Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
76d53a85
Commit
76d53a85
authored
Jul 02, 2020
by
Jason R. Coombs
Committed by
GitHub
Jul 02, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1 from pypa/feature/integrate-pypy
Add support for PyPy
parents
4f1d1598
c3a052ae
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
36 deletions
+84
-36
distutils/command/install.py
distutils/command/install.py
+20
-0
distutils/sysconfig.py
distutils/sysconfig.py
+49
-36
distutils/tests/test_sysconfig.py
distutils/tests/test_sysconfig.py
+1
-0
distutils/tests/test_unixccompiler.py
distutils/tests/test_unixccompiler.py
+14
-0
No files found.
distutils/command/install.py
View file @
76d53a85
...
@@ -43,6 +43,20 @@ INSTALL_SCHEMES = {
...
@@ -43,6 +43,20 @@ INSTALL_SCHEMES = {
'data'
:
'$base'
,
'data'
:
'$base'
,
},
},
'nt'
:
WINDOWS_SCHEME
,
'nt'
:
WINDOWS_SCHEME
,
'pypy'
:
{
'purelib'
:
'$base/site-packages'
,
'platlib'
:
'$base/site-packages'
,
'headers'
:
'$base/include/$dist_name'
,
'scripts'
:
'$base/bin'
,
'data'
:
'$base'
,
},
'pypy_nt'
:
{
'purelib'
:
'$base/site-packages'
,
'platlib'
:
'$base/site-packages'
,
'headers'
:
'$base/include/$dist_name'
,
'scripts'
:
'$base/Scripts'
,
'data'
:
'$base'
,
},
}
}
# user site schemes
# user site schemes
...
@@ -455,6 +469,12 @@ class install(Command):
...
@@ -455,6 +469,12 @@ class install(Command):
def
select_scheme
(
self
,
name
):
def
select_scheme
(
self
,
name
):
"""Sets the install directories by applying the install schemes."""
"""Sets the install directories by applying the install schemes."""
# it's the caller's problem if they supply a bad name!
# it's the caller's problem if they supply a bad name!
if
(
hasattr
(
sys
,
'pypy_version_info'
)
and
not
name
.
endswith
((
'_user'
,
'_home'
))):
if
os
.
name
==
'nt'
:
name
=
'pypy_nt'
else
:
name
=
'pypy'
scheme
=
INSTALL_SCHEMES
[
name
]
scheme
=
INSTALL_SCHEMES
[
name
]
for
key
in
SCHEME_KEYS
:
for
key
in
SCHEME_KEYS
:
attrname
=
'install_'
+
key
attrname
=
'install_'
+
key
...
...
distutils/sysconfig.py
View file @
76d53a85
...
@@ -16,6 +16,8 @@ import sys
...
@@ -16,6 +16,8 @@ import sys
from
.errors
import
DistutilsPlatformError
from
.errors
import
DistutilsPlatformError
IS_PYPY
=
'__pypy__'
in
sys
.
builtin_module_names
# These are needed in a couple of spots, so just compute them once.
# These are needed in a couple of spots, so just compute them once.
PREFIX
=
os
.
path
.
normpath
(
sys
.
prefix
)
PREFIX
=
os
.
path
.
normpath
(
sys
.
prefix
)
EXEC_PREFIX
=
os
.
path
.
normpath
(
sys
.
exec_prefix
)
EXEC_PREFIX
=
os
.
path
.
normpath
(
sys
.
exec_prefix
)
...
@@ -97,7 +99,9 @@ def get_python_inc(plat_specific=0, prefix=None):
...
@@ -97,7 +99,9 @@ def get_python_inc(plat_specific=0, prefix=None):
"""
"""
if
prefix
is
None
:
if
prefix
is
None
:
prefix
=
plat_specific
and
BASE_EXEC_PREFIX
or
BASE_PREFIX
prefix
=
plat_specific
and
BASE_EXEC_PREFIX
or
BASE_PREFIX
if
os
.
name
==
"posix"
:
if
IS_PYPY
:
return
os
.
path
.
join
(
prefix
,
'include'
)
elif
os
.
name
==
"posix"
:
if
python_build
:
if
python_build
:
# Assume the executable is in the build directory. The
# Assume the executable is in the build directory. The
# pyconfig.h file should be in the same directory. Since
# pyconfig.h file should be in the same directory. Since
...
@@ -138,6 +142,14 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
...
@@ -138,6 +142,14 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
If 'prefix' is supplied, use it instead of sys.base_prefix or
If 'prefix' is supplied, use it instead of sys.base_prefix or
sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
"""
"""
if
IS_PYPY
:
# PyPy-specific schema
if
prefix
is
None
:
prefix
=
PREFIX
if
standard_lib
:
return
os
.
path
.
join
(
prefix
,
"lib-python"
,
sys
.
version
[
0
])
return
os
.
path
.
join
(
prefix
,
'site-packages'
)
if
prefix
is
None
:
if
prefix
is
None
:
if
standard_lib
:
if
standard_lib
:
prefix
=
plat_specific
and
BASE_EXEC_PREFIX
or
BASE_PREFIX
prefix
=
plat_specific
and
BASE_EXEC_PREFIX
or
BASE_PREFIX
...
@@ -499,6 +511,7 @@ def get_config_vars(*args):
...
@@ -499,6 +511,7 @@ def get_config_vars(*args):
_config_vars['prefix'] = PREFIX
_config_vars['prefix'] = PREFIX
_config_vars['exec_prefix'] = EXEC_PREFIX
_config_vars['exec_prefix'] = EXEC_PREFIX
if not IS_PYPY:
# For backward compatibility, see issue19555
# For backward compatibility, see issue19555
SO = _config_vars.get('EXT_SUFFIX')
SO = _config_vars.get('EXT_SUFFIX')
if SO is not None:
if SO is not None:
...
...
distutils/tests/test_sysconfig.py
View file @
76d53a85
...
@@ -45,6 +45,7 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
...
@@ -45,6 +45,7 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
self
.
assertIsInstance
(
cvars
,
dict
)
self
.
assertIsInstance
(
cvars
,
dict
)
self
.
assertTrue
(
cvars
)
self
.
assertTrue
(
cvars
)
@
unittest
.
skip
(
'sysconfig.IS_PYPY'
)
def
test_srcdir
(
self
):
def
test_srcdir
(
self
):
# See Issues #15322, #15364.
# See Issues #15322, #15364.
srcdir
=
sysconfig
.
get_config_var
(
'srcdir'
)
srcdir
=
sysconfig
.
get_config_var
(
'srcdir'
)
...
...
distutils/tests/test_unixccompiler.py
View file @
76d53a85
...
@@ -11,6 +11,7 @@ class UnixCCompilerTestCase(unittest.TestCase):
...
@@ -11,6 +11,7 @@ class UnixCCompilerTestCase(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
_backup_platform
=
sys
.
platform
self
.
_backup_platform
=
sys
.
platform
self
.
_backup_get_config_var
=
sysconfig
.
get_config_var
self
.
_backup_get_config_var
=
sysconfig
.
get_config_var
self
.
_backup_get_config_vars
=
sysconfig
.
get_config_vars
class
CompilerWrapper
(
UnixCCompiler
):
class
CompilerWrapper
(
UnixCCompiler
):
def
rpath_foo
(
self
):
def
rpath_foo
(
self
):
return
self
.
runtime_library_dir_option
(
'/foo'
)
return
self
.
runtime_library_dir_option
(
'/foo'
)
...
@@ -19,6 +20,7 @@ class UnixCCompilerTestCase(unittest.TestCase):
...
@@ -19,6 +20,7 @@ class UnixCCompilerTestCase(unittest.TestCase):
def
tearDown
(
self
):
def
tearDown
(
self
):
sys
.
platform
=
self
.
_backup_platform
sys
.
platform
=
self
.
_backup_platform
sysconfig
.
get_config_var
=
self
.
_backup_get_config_var
sysconfig
.
get_config_var
=
self
.
_backup_get_config_var
sysconfig
.
get_config_vars
=
self
.
_backup_get_config_vars
@
unittest
.
skipIf
(
sys
.
platform
==
'win32'
,
"can't test on Windows"
)
@
unittest
.
skipIf
(
sys
.
platform
==
'win32'
,
"can't test on Windows"
)
def
test_runtime_libdir_option
(
self
):
def
test_runtime_libdir_option
(
self
):
...
@@ -110,7 +112,13 @@ class UnixCCompilerTestCase(unittest.TestCase):
...
@@ -110,7 +112,13 @@ class UnixCCompilerTestCase(unittest.TestCase):
if
v
==
'LDSHARED'
:
if
v
==
'LDSHARED'
:
return
'gcc-4.2 -bundle -undefined dynamic_lookup '
return
'gcc-4.2 -bundle -undefined dynamic_lookup '
return
'gcc-4.2'
return
'gcc-4.2'
def
gcvs
(
*
args
,
_orig
=
sysconfig
.
get_config_vars
):
if
args
:
return
list
(
map
(
sysconfig
.
get_config_var
,
args
))
return
_orig
()
sysconfig
.
get_config_var
=
gcv
sysconfig
.
get_config_var
=
gcv
sysconfig
.
get_config_vars
=
gcvs
with
EnvironmentVarGuard
()
as
env
:
with
EnvironmentVarGuard
()
as
env
:
env
[
'CC'
]
=
'my_cc'
env
[
'CC'
]
=
'my_cc'
del
env
[
'LDSHARED'
]
del
env
[
'LDSHARED'
]
...
@@ -126,7 +134,13 @@ class UnixCCompilerTestCase(unittest.TestCase):
...
@@ -126,7 +134,13 @@ class UnixCCompilerTestCase(unittest.TestCase):
if
v
==
'LDSHARED'
:
if
v
==
'LDSHARED'
:
return
'gcc-4.2 -bundle -undefined dynamic_lookup '
return
'gcc-4.2 -bundle -undefined dynamic_lookup '
return
'gcc-4.2'
return
'gcc-4.2'
def
gcvs
(
*
args
,
_orig
=
sysconfig
.
get_config_vars
):
if
args
:
return
list
(
map
(
sysconfig
.
get_config_var
,
args
))
return
_orig
()
sysconfig
.
get_config_var
=
gcv
sysconfig
.
get_config_var
=
gcv
sysconfig
.
get_config_vars
=
gcvs
with
EnvironmentVarGuard
()
as
env
:
with
EnvironmentVarGuard
()
as
env
:
env
[
'CC'
]
=
'my_cc'
env
[
'CC'
]
=
'my_cc'
env
[
'LDSHARED'
]
=
'my_ld -bundle -dynamic'
env
[
'LDSHARED'
]
=
'my_ld -bundle -dynamic'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment