Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
85677617
Commit
85677617
authored
Mar 10, 2010
by
Florent Xicluna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #7880: Fix sysconfig when the python executable is a symbolic link.
parent
3ec32005
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
7 deletions
+27
-7
Lib/sysconfig.py
Lib/sysconfig.py
+6
-6
Lib/test/test_sysconfig.py
Lib/test/test_sysconfig.py
+19
-1
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/sysconfig.py
View file @
85677617
...
...
@@ -3,7 +3,7 @@
"""
import
sys
import
os
from
os.path
import
pardir
,
abs
path
from
os.path
import
pardir
,
real
path
_INSTALL_SCHEMES
=
{
'posix_prefix'
:
{
...
...
@@ -84,16 +84,16 @@ _PREFIX = os.path.normpath(sys.prefix)
_EXEC_PREFIX
=
os
.
path
.
normpath
(
sys
.
exec_prefix
)
_CONFIG_VARS
=
None
_USER_BASE
=
None
_PROJECT_BASE
=
abspath
(
os
.
path
.
dirname
(
sys
.
executable
))
_PROJECT_BASE
=
os
.
path
.
dirname
(
realpath
(
sys
.
executable
))
if
os
.
name
==
"nt"
and
"pcbuild"
in
_PROJECT_BASE
[
-
8
:].
lower
():
_PROJECT_BASE
=
abs
path
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
))
_PROJECT_BASE
=
real
path
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
))
# PC/VS7.1
if
os
.
name
==
"nt"
and
"
\
\
pc
\
\
v"
in
_PROJECT_BASE
[
-
10
:].
lower
():
_PROJECT_BASE
=
abs
path
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
,
pardir
))
_PROJECT_BASE
=
real
path
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
,
pardir
))
# PC/AMD64
if
os
.
name
==
"nt"
and
"
\
\
pcbuild
\
\
amd64"
in
_PROJECT_BASE
[
-
14
:].
lower
():
_PROJECT_BASE
=
abs
path
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
,
pardir
))
_PROJECT_BASE
=
real
path
(
os
.
path
.
join
(
_PROJECT_BASE
,
pardir
,
pardir
))
def
is_python_build
():
for
fn
in
(
"Setup.dist"
,
"Setup.local"
):
...
...
@@ -294,7 +294,7 @@ def _init_non_posix(vars):
vars['SO'] = '.pyd'
vars['EXE'] = '.exe'
vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
vars['BINDIR'] = os.path.dirname(
os.path.abs
path(sys.executable))
vars['BINDIR'] = os.path.dirname(
real
path(sys.executable))
#
# public APIs
...
...
Lib/test/test_sysconfig.py
View file @
85677617
...
...
@@ -8,9 +8,10 @@ import unittest
import
sys
import
os
import
shutil
import
subprocess
from
copy
import
copy
,
deepcopy
from
test.test_support
import
run_unittest
,
TESTFN
from
test.test_support
import
run_unittest
,
TESTFN
,
unlink
,
get_attribute
import
sysconfig
from
sysconfig
import
(
get_paths
,
get_platform
,
get_config_vars
,
...
...
@@ -238,6 +239,23 @@ class TestSysConfig(unittest.TestCase):
'posix_prefix'
,
'posix_user'
)
self
.
assertEquals
(
get_scheme_names
(),
wanted
)
def
test_symlink
(
self
):
# Issue 7880
symlink
=
get_attribute
(
os
,
"symlink"
)
def
get
(
python
):
cmd
=
[
python
,
'-c'
,
'import sysconfig; print sysconfig.get_platform()'
]
p
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
return
p
.
communicate
()
real
=
os
.
path
.
realpath
(
sys
.
executable
)
link
=
os
.
path
.
abspath
(
TESTFN
)
symlink
(
real
,
link
)
try
:
self
.
assertEqual
(
get
(
real
),
get
(
link
))
finally
:
unlink
(
link
)
def
test_main
():
run_unittest
(
TestSysConfig
)
...
...
Misc/NEWS
View file @
85677617
...
...
@@ -20,6 +20,8 @@ Core and Builtins
Library
-------
- Issue #7880: Fix sysconfig when the python executable is a symbolic link.
- Issue #7624: Fix isinstance(foo(), collections.Callable) for old-style
classes.
...
...
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