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
389afeb0
Commit
389afeb0
authored
Jan 26, 2010
by
Tarek Ziadé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added local get_platform/set_platform APIs in distutils.sysconfig
parent
be0a428e
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
42 additions
and
112 deletions
+42
-112
command/bdist.py
command/bdist.py
+1
-1
command/bdist_dumb.py
command/bdist_dumb.py
+2
-1
command/bdist_msi.py
command/bdist_msi.py
+2
-1
command/bdist_wininst.py
command/bdist_wininst.py
+2
-1
command/build.py
command/build.py
+1
-1
command/build_ext.py
command/build_ext.py
+1
-3
command/install.py
command/install.py
+2
-3
msvc9compiler.py
msvc9compiler.py
+5
-5
tests/test_util.py
tests/test_util.py
+6
-93
util.py
util.py
+20
-3
No files found.
command/bdist.py
View file @
389afeb0
...
@@ -6,8 +6,8 @@ distribution)."""
...
@@ -6,8 +6,8 @@ distribution)."""
__revision__
=
"$Id$"
__revision__
=
"$Id$"
import
os
import
os
from
sysconfig
import
get_platform
from
distutils.util
import
get_platform
from
distutils.core
import
Command
from
distutils.core
import
Command
from
distutils.errors
import
DistutilsPlatformError
,
DistutilsOptionError
from
distutils.errors
import
DistutilsPlatformError
,
DistutilsOptionError
...
...
command/bdist_dumb.py
View file @
389afeb0
...
@@ -8,8 +8,9 @@ __revision__ = "$Id$"
...
@@ -8,8 +8,9 @@ __revision__ = "$Id$"
import
os
import
os
from
sysconfig
import
get_python_version
,
get_platform
from
sysconfig
import
get_python_version
from
distutils.util
import
get_platform
from
distutils.core
import
Command
from
distutils.core
import
Command
from
distutils.dir_util
import
remove_tree
,
ensure_relative
from
distutils.dir_util
import
remove_tree
,
ensure_relative
from
distutils.errors
import
DistutilsPlatformError
from
distutils.errors
import
DistutilsPlatformError
...
...
command/bdist_msi.py
View file @
389afeb0
...
@@ -7,13 +7,14 @@
...
@@ -7,13 +7,14 @@
Implements the bdist_msi command.
Implements the bdist_msi command.
"""
"""
import
sys
,
os
import
sys
,
os
from
sysconfig
import
get_python_version
,
get_platform
from
sysconfig
import
get_python_version
from
distutils.core
import
Command
from
distutils.core
import
Command
from
distutils.dir_util
import
remove_tree
from
distutils.dir_util
import
remove_tree
from
distutils.version
import
StrictVersion
from
distutils.version
import
StrictVersion
from
distutils.errors
import
DistutilsOptionError
from
distutils.errors
import
DistutilsOptionError
from
distutils
import
log
from
distutils
import
log
from
distutils.util
import
get_platform
import
msilib
import
msilib
from
msilib
import
schema
,
sequence
,
text
from
msilib
import
schema
,
sequence
,
text
...
...
command/bdist_wininst.py
View file @
389afeb0
...
@@ -9,12 +9,13 @@ import sys
...
@@ -9,12 +9,13 @@ import sys
import
os
import
os
import
string
import
string
from
sysconfig
import
get_python_version
,
get_platform
from
sysconfig
import
get_python_version
from
distutils.core
import
Command
from
distutils.core
import
Command
from
distutils.dir_util
import
remove_tree
from
distutils.dir_util
import
remove_tree
from
distutils.errors
import
DistutilsOptionError
,
DistutilsPlatformError
from
distutils.errors
import
DistutilsOptionError
,
DistutilsPlatformError
from
distutils
import
log
from
distutils
import
log
from
distutils.util
import
get_platform
class
bdist_wininst
(
Command
):
class
bdist_wininst
(
Command
):
...
...
command/build.py
View file @
389afeb0
...
@@ -5,8 +5,8 @@ Implements the Distutils 'build' command."""
...
@@ -5,8 +5,8 @@ Implements the Distutils 'build' command."""
__revision__
=
"$Id$"
__revision__
=
"$Id$"
import
sys
,
os
import
sys
,
os
from
sysconfig
import
get_platform
from
distutils.util
import
get_platform
from
distutils.core
import
Command
from
distutils.core
import
Command
from
distutils.errors
import
DistutilsOptionError
from
distutils.errors
import
DistutilsOptionError
...
...
command/build_ext.py
View file @
389afeb0
...
@@ -9,14 +9,12 @@ __revision__ = "$Id$"
...
@@ -9,14 +9,12 @@ __revision__ = "$Id$"
import
sys
,
os
,
re
import
sys
,
os
,
re
from
warnings
import
warn
from
warnings
import
warn
from
sysconfig
import
get_platform
from
distutils.util
import
get_platform
from
distutils.core
import
Command
from
distutils.core
import
Command
from
distutils.errors
import
*
from
distutils.errors
import
*
from
distutils.ccompiler
import
customize_compiler
from
distutils.ccompiler
import
customize_compiler
from
distutils.dep_util
import
newer_group
from
distutils.dep_util
import
newer_group
from
distutils.extension
import
Extension
from
distutils.extension
import
Extension
from
distutils
import
log
from
distutils
import
log
# this keeps compatibility from 2.3 to 2.5
# this keeps compatibility from 2.3 to 2.5
...
...
command/install.py
View file @
389afeb0
...
@@ -7,15 +7,14 @@ __revision__ = "$Id$"
...
@@ -7,15 +7,14 @@ __revision__ = "$Id$"
import
sys
import
sys
import
os
import
os
from
sysconfig
import
(
get_config_vars
,
get_platform
,
get_paths
,
get_path
,
from
sysconfig
import
get_config_vars
,
get_paths
,
get_path
,
get_config_var
get_config_var
)
from
distutils
import
log
from
distutils
import
log
from
distutils.core
import
Command
from
distutils.core
import
Command
from
distutils.debug
import
DEBUG
from
distutils.debug
import
DEBUG
from
distutils.errors
import
DistutilsPlatformError
from
distutils.errors
import
DistutilsPlatformError
from
distutils.file_util
import
write_file
from
distutils.file_util
import
write_file
from
distutils.util
import
convert_path
,
change_root
from
distutils.util
import
convert_path
,
change_root
,
get_platform
from
distutils.errors
import
DistutilsOptionError
from
distutils.errors
import
DistutilsOptionError
def
_subst_vars
(
s
,
local_vars
):
def
_subst_vars
(
s
,
local_vars
):
...
...
msvc9compiler.py
View file @
389afeb0
...
@@ -23,9 +23,9 @@ from distutils.errors import (DistutilsExecError, DistutilsPlatformError,
...
@@ -23,9 +23,9 @@ from distutils.errors import (DistutilsExecError, DistutilsPlatformError,
CompileError
,
LibError
,
LinkError
)
CompileError
,
LibError
,
LinkError
)
from
distutils.ccompiler
import
CCompiler
,
gen_lib_options
from
distutils.ccompiler
import
CCompiler
,
gen_lib_options
from
distutils
import
log
from
distutils
import
log
import
_winreg
from
distutils.util
import
get_platform
_sysconfig
=
__import__
(
'sysconfig'
)
import
_winreg
RegOpenKeyEx
=
_winreg
.
OpenKeyEx
RegOpenKeyEx
=
_winreg
.
OpenKeyEx
RegEnumKey
=
_winreg
.
EnumKey
RegEnumKey
=
_winreg
.
EnumKey
...
@@ -327,7 +327,7 @@ class MSVCCompiler(CCompiler) :
...
@@ -327,7 +327,7 @@ class MSVCCompiler(CCompiler) :
# multi-init means we would need to check platform same each time...
# multi-init means we would need to check platform same each time...
assert not self.initialized, "
don
't init multiple times"
assert not self.initialized, "
don
't init multiple times"
if plat_name is None:
if plat_name is None:
plat_name =
_sysconfig.
get_platform()
plat_name = get_platform()
# sanity check for platforms to prevent obscure errors later.
# sanity check for platforms to prevent obscure errors later.
ok_plats = '
win32
', '
win
-
amd64
', '
win
-
ia64
'
ok_plats = '
win32
', '
win
-
amd64
', '
win
-
ia64
'
if plat_name not in ok_plats:
if plat_name not in ok_plats:
...
@@ -348,12 +348,12 @@ class MSVCCompiler(CCompiler) :
...
@@ -348,12 +348,12 @@ class MSVCCompiler(CCompiler) :
# On AMD64, 'vcvars32.bat amd64' is a native build env; to cross
# On AMD64, 'vcvars32.bat amd64' is a native build env; to cross
# compile use 'x86' (ie, it runs the x86 compiler directly)
# compile use 'x86' (ie, it runs the x86 compiler directly)
# No idea how itanium handles this, if at all.
# No idea how itanium handles this, if at all.
if
plat_name
==
_sysconfig
.
get_platform
()
or
plat_name
==
'win32'
:
if
plat_name
==
get_platform
()
or
plat_name
==
'win32'
:
# native build or cross-compile to win32
# native build or cross-compile to win32
plat_spec
=
PLAT_TO_VCVARS
[
plat_name
]
plat_spec
=
PLAT_TO_VCVARS
[
plat_name
]
else
:
else
:
# cross compile from win32 -> some 64bit
# cross compile from win32 -> some 64bit
plat_spec
=
PLAT_TO_VCVARS
[
_sysconfig
.
get_platform
()]
+
'_'
+
\
plat_spec
=
PLAT_TO_VCVARS
[
get_platform
()]
+
'_'
+
\
PLAT_TO_VCVARS
[
plat_name
]
PLAT_TO_VCVARS
[
plat_name
]
vc_env
=
query_vcvarsall
(
VERSION
,
plat_spec
)
vc_env
=
query_vcvarsall
(
VERSION
,
plat_spec
)
...
...
tests/test_util.py
View file @
389afeb0
...
@@ -90,99 +90,12 @@ class UtilTestCase(support.EnvironGuard, unittest.TestCase):
...
@@ -90,99 +90,12 @@ class UtilTestCase(support.EnvironGuard, unittest.TestCase):
def
_get_uname
(
self
):
def
_get_uname
(
self
):
return
self
.
_uname
return
self
.
_uname
def
_test_get_platform
(
self
):
def
test_get_platform
(
self
):
platform
=
util
.
get_platform
()
# windows XP, 32bits
self
.
assertEquals
(
platform
,
get_platform
())
os
.
name
=
'nt'
util
.
set_platform
(
'MyOwnPlatform'
)
sys
.
version
=
(
'2.4.4 (#71, Oct 18 2006, 08:34:43) '
self
.
assertEquals
(
'MyOwnPlatform'
,
util
.
get_platform
())
'[MSC v.1310 32 bit (Intel)]'
)
util
.
set_platform
(
platform
)
sys
.
platform
=
'win32'
self
.
assertEquals
(
get_platform
(),
'win32'
)
# windows XP, amd64
os
.
name
=
'nt'
sys
.
version
=
(
'2.4.4 (#71, Oct 18 2006, 08:34:43) '
'[MSC v.1310 32 bit (Amd64)]'
)
sys
.
platform
=
'win32'
self
.
assertEquals
(
get_platform
(),
'win-amd64'
)
# windows XP, itanium
os
.
name
=
'nt'
sys
.
version
=
(
'2.4.4 (#71, Oct 18 2006, 08:34:43) '
'[MSC v.1310 32 bit (Itanium)]'
)
sys
.
platform
=
'win32'
self
.
assertEquals
(
get_platform
(),
'win-ia64'
)
# macbook
os
.
name
=
'posix'
sys
.
version
=
(
'2.5 (r25:51918, Sep 19 2006, 08:49:13) '
'
\
n
[GCC 4.0.1 (Apple Computer, Inc. build 5341)]'
)
sys
.
platform
=
'darwin'
self
.
_set_uname
((
'Darwin'
,
'macziade'
,
'8.11.1'
,
(
'Darwin Kernel Version 8.11.1: '
'Wed Oct 10 18:23:28 PDT 2007; '
'root:xnu-792.25.20~1/RELEASE_I386'
),
'i386'
))
os
.
environ
[
'MACOSX_DEPLOYMENT_TARGET'
]
=
'10.3'
get_config_vars
()[
'CFLAGS'
]
=
(
'-fno-strict-aliasing -DNDEBUG -g '
'-fwrapv -O3 -Wall -Wstrict-prototypes'
)
self
.
assertEquals
(
get_platform
(),
'macosx-10.3-i386'
)
# macbook with fat binaries (fat, universal or fat64)
os
.
environ
[
'MACOSX_DEPLOYMENT_TARGET'
]
=
'10.4'
get_config_vars
()[
'CFLAGS'
]
=
(
'-arch ppc -arch i386 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3'
)
self
.
assertEquals
(
get_platform
(),
'macosx-10.4-fat'
)
get_config_vars
()[
'CFLAGS'
]
=
(
'-arch x86_64 -arch i386 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3'
)
self
.
assertEquals
(
get_platform
(),
'macosx-10.4-intel'
)
get_config_vars
()[
'CFLAGS'
]
=
(
'-arch x86_64 -arch ppc -arch i386 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3'
)
self
.
assertEquals
(
get_platform
(),
'macosx-10.4-fat3'
)
get_config_vars
()[
'CFLAGS'
]
=
(
'-arch ppc64 -arch x86_64 -arch ppc -arch i386 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3'
)
self
.
assertEquals
(
get_platform
(),
'macosx-10.4-universal'
)
get_config_vars
()[
'CFLAGS'
]
=
(
'-arch x86_64 -arch ppc64 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3'
)
self
.
assertEquals
(
get_platform
(),
'macosx-10.4-fat64'
)
for
arch
in
(
'ppc'
,
'i386'
,
'x86_64'
,
'ppc64'
):
get_config_vars
()[
'CFLAGS'
]
=
(
'-arch %s -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3'
%
(
arch
,))
self
.
assertEquals
(
get_platform
(),
'macosx-10.4-%s'
%
(
arch
,))
# linux debian sarge
os
.
name
=
'posix'
sys
.
version
=
(
'2.3.5 (#1, Jul 4 2007, 17:28:59) '
'
\
n
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)]'
)
sys
.
platform
=
'linux2'
self
.
_set_uname
((
'Linux'
,
'aglae'
,
'2.6.21.1dedibox-r7'
,
'#1 Mon Apr 30 17:25:38 CEST 2007'
,
'i686'
))
self
.
assertEquals
(
get_platform
(),
'linux-i686'
)
# XXX more platforms to tests here
def
test_convert_path
(
self
):
def
test_convert_path
(
self
):
# linux/mac
# linux/mac
...
...
util.py
View file @
389afeb0
...
@@ -16,10 +16,27 @@ from distutils.version import LooseVersion
...
@@ -16,10 +16,27 @@ from distutils.version import LooseVersion
from
distutils.errors
import
DistutilsByteCompileError
from
distutils.errors
import
DistutilsByteCompileError
_sysconfig
=
__import__
(
'sysconfig'
)
_sysconfig
=
__import__
(
'sysconfig'
)
_PLATFORM
=
None
# kept for backward compatibility
def
get_platform
():
# since this API was relocated
"""Return a string that identifies the current platform.
get_platform
=
_sysconfig
.
get_platform
By default, will return the value returned by sysconfig.get_platform(),
but it can be changed by calling set_platform().
"""
global
_PLATFORM
if
_PLATFORM
is
None
:
_PLATFORM
=
_sysconfig
.
get_platform
()
return
_PLATFORM
def
set_platform
(
identifier
):
"""Sets the platform string identifier returned by get_platform().
Note that this change doesn't impact the value returned by
sysconfig.get_platform() and is local to Distutils
"""
global
_PLATFORM
_PLATFORM
=
identifier
def
convert_path
(
pathname
):
def
convert_path
(
pathname
):
"""Return 'pathname' as a name that will work on the native filesystem.
"""Return 'pathname' as a name that will work on the native filesystem.
...
...
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