Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
2737222b
Kaydet (Commit)
2737222b
authored
Agu 21, 2011
tarafından
Éric Araujo
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Factor out the build_ext fixup for shared Python builds.
I need this to fix the failing test_command_install_dist.
üst
cd7c3d9d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
22 deletions
+29
-22
support.py
Lib/packaging/tests/support.py
+27
-1
test_command_build_ext.py
Lib/packaging/tests/test_command_build_ext.py
+2
-21
No files found.
Lib/packaging/tests/support.py
Dosyayı görüntüle @
2737222b
...
...
@@ -28,6 +28,7 @@ Each class or function has a docstring to explain its purpose and usage.
"""
import
os
import
sys
import
shutil
import
logging
import
weakref
...
...
@@ -279,7 +280,7 @@ def copy_xxmodule_c(directory):
def test_compile(self):
copy_xxmodule_c(self.tmpdir)
self.assertIn('xxmodule.c', os.listdir(self.tmpdir)
self.assertIn('xxmodule.c', os.listdir(self.tmpdir)
)
If the source file can be found, it will be copied to *directory*. If not,
the test will be skipped. Errors during copy are not caught.
...
...
@@ -304,6 +305,31 @@ def _get_xxmodule_path():
return
path
def
fixup_build_ext
(
cmd
):
"""Function needed to make build_ext tests pass on shared builds.
When Python was build with --enable-shared, -L. is not good enough to find
the libpython<blah>.so. This is because regrtest runs it under a tempdir,
not in the top level where the .so lives. By the time we've gotten here,
Python's already been chdir'd to the tempdir. This function work arounds
that. Example use:
cmd = build_ext(dist)
support.fixup_build_ext(cmd)
cmd.ensure_finalized()
"""
# To further add to the fun, we can't just add library_dirs to the
# Extension() instance because that doesn't get plumbed through to the
# final compiler command.
if
(
sysconfig
.
get_config_var
(
'Py_ENABLE_SHARED'
)
and
not
sys
.
platform
.
startswith
(
'win'
)):
runshared
=
sysconfig
.
get_config_var
(
'RUNSHARED'
)
if
runshared
is
None
:
cmd
.
library_dirs
=
[
'.'
]
else
:
name
,
equals
,
value
=
runshared
.
partition
(
'='
)
cmd
.
library_dirs
=
value
.
split
(
os
.
pathsep
)
try
:
from
test.support
import
skip_unless_symlink
except
ImportError
:
...
...
Lib/packaging/tests/test_command_build_ext.py
Dosyayı görüntüle @
2737222b
...
...
@@ -32,25 +32,6 @@ class BuildExtTestCase(support.TempdirManager,
super
(
BuildExtTestCase
,
self
)
.
tearDown
()
def
_fixup_command
(
self
,
cmd
):
# When Python was build with --enable-shared, -L. is not good enough
# to find the libpython<blah>.so. This is because regrtest runs it
# under a tempdir, not in the top level where the .so lives. By the
# time we've gotten here, Python's already been chdir'd to the
# tempdir.
#
# To further add to the fun, we can't just add library_dirs to the
# Extension() instance because that doesn't get plumbed through to the
# final compiler command.
if
(
sysconfig
.
get_config_var
(
'Py_ENABLE_SHARED'
)
and
not
sys
.
platform
.
startswith
(
'win'
)):
runshared
=
sysconfig
.
get_config_var
(
'RUNSHARED'
)
if
runshared
is
None
:
cmd
.
library_dirs
=
[
'.'
]
else
:
name
,
equals
,
value
=
runshared
.
partition
(
'='
)
cmd
.
library_dirs
=
value
.
split
(
os
.
pathsep
)
def
test_build_ext
(
self
):
support
.
copy_xxmodule_c
(
self
.
tmp_dir
)
xx_c
=
os
.
path
.
join
(
self
.
tmp_dir
,
'xxmodule.c'
)
...
...
@@ -58,7 +39,7 @@ class BuildExtTestCase(support.TempdirManager,
dist
=
Distribution
({
'name'
:
'xx'
,
'ext_modules'
:
[
xx_ext
]})
dist
.
package_dir
=
self
.
tmp_dir
cmd
=
build_ext
(
dist
)
s
elf
.
_fixup_command
(
cmd
)
s
upport
.
fixup_build_ext
(
cmd
)
if
os
.
name
==
"nt"
:
# On Windows, we must build a debug version iff running
...
...
@@ -251,7 +232,7 @@ class BuildExtTestCase(support.TempdirManager,
dist
=
Distribution
({
'name'
:
'xx'
,
'ext_modules'
:
[
ext
]})
cmd
=
build_ext
(
dist
)
s
elf
.
_fixup_command
(
cmd
)
s
upport
.
fixup_build_ext
(
cmd
)
cmd
.
ensure_finalized
()
self
.
assertEqual
(
len
(
cmd
.
get_outputs
()),
1
)
...
...
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