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
afc36e0f
Commit
afc36e0f
authored
May 07, 2009
by
Tarek Ziadé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #5941: added ARFLAGS for the archiver command.
parent
8bbedf87
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
5 deletions
+50
-5
sysconfig.py
sysconfig.py
+7
-3
tests/test_build_clib.py
tests/test_build_clib.py
+40
-0
tests/test_sysconfig.py
tests/test_sysconfig.py
+3
-2
No files found.
sysconfig.py
View file @
afc36e0f
...
...
@@ -165,9 +165,9 @@ def customize_compiler(compiler):
varies across Unices and is stored in Python's Makefile.
"""
if
compiler
.
compiler_type
==
"unix"
:
(
cc
,
cxx
,
opt
,
cflags
,
ccshared
,
ldshared
,
so_ext
,
ar
)
=
\
(
cc
,
cxx
,
opt
,
cflags
,
ccshared
,
ldshared
,
so_ext
,
ar
,
ar_flags
)
=
\
get_config_vars
(
'CC'
,
'CXX'
,
'OPT'
,
'CFLAGS'
,
'CCSHARED'
,
'LDSHARED'
,
'SO'
,
'AR'
)
'CCSHARED'
,
'LDSHARED'
,
'SO'
,
'AR'
,
'ARFLAGS'
)
if
'CC'
in
os
.
environ
:
cc
=
os
.
environ
[
'CC'
]
...
...
@@ -190,6 +190,10 @@ def customize_compiler(compiler):
ldshared
=
ldshared
+
' '
+
os
.
environ
[
'CPPFLAGS'
]
if
'AR'
in
os
.
environ
:
ar
=
os
.
environ
[
'AR'
]
if
'ARFLAGS'
in
os
.
environ
:
archiver
=
ar
+
' '
+
os
.
environ
[
'ARFLAGS'
]
else
:
archiver
=
ar
+
' '
+
ar_flags
cc_cmd
=
cc
+
' '
+
cflags
compiler
.
set_executables
(
...
...
@@ -199,7 +203,7 @@ def customize_compiler(compiler):
compiler_cxx
=
cxx
,
linker_so
=
ldshared
,
linker_exe
=
cc
,
archiver
=
ar
)
archiver
=
ar
chiver
)
compiler
.
shared_lib_extension
=
so_ext
...
...
tests/test_build_clib.py
View file @
afc36e0f
"""Tests for distutils.command.build_clib."""
import
unittest
import
os
import
sys
from
distutils.command.build_clib
import
build_clib
from
distutils.errors
import
DistutilsSetupError
from
distutils.tests
import
support
from
distutils.spawn
import
find_executable
class
BuildCLibTestCase
(
support
.
TempdirManager
,
support
.
LoggingSilencer
,
...
...
@@ -97,6 +100,43 @@ class BuildCLibTestCase(support.TempdirManager,
cmd
.
distribution
.
libraries
=
'WONTWORK'
self
.
assertRaises
(
DistutilsSetupError
,
cmd
.
finalize_options
)
def
test_run
(
self
):
# can't test on windows
if
sys
.
platform
==
'win32'
:
return
pkg_dir
,
dist
=
self
.
create_dist
()
cmd
=
build_clib
(
dist
)
foo_c
=
os
.
path
.
join
(
pkg_dir
,
'foo.c'
)
self
.
write_file
(
foo_c
,
'int main(void) { return 1;}'
)
cmd
.
libraries
=
[(
'foo'
,
{
'sources'
:
[
foo_c
]})]
build_temp
=
os
.
path
.
join
(
pkg_dir
,
'build'
)
os
.
mkdir
(
build_temp
)
cmd
.
build_temp
=
build_temp
cmd
.
build_clib
=
build_temp
# before we run the command, we want to make sure
# all commands are present on the system
# by creating a compiler and checking its executables
from
distutils.ccompiler
import
new_compiler
from
distutils.sysconfig
import
customize_compiler
compiler
=
new_compiler
()
customize_compiler
(
compiler
)
for
ccmd
in
compiler
.
executables
.
values
():
if
ccmd
is
None
:
continue
if
find_executable
(
ccmd
[
0
])
is
None
:
return
# can't test
# this should work
cmd
.
run
()
# let's check the result
self
.
assert_
(
'libfoo.a'
in
os
.
listdir
(
build_temp
))
def
test_suite
():
return
unittest
.
makeSuite
(
BuildCLibTestCase
)
...
...
tests/test_sysconfig.py
View file @
afc36e0f
...
...
@@ -49,7 +49,8 @@ class SysconfigTestCase(unittest.TestCase):
if
get_default_compiler
()
!=
'unix'
:
return
os
.
environ
[
'AR'
]
=
'xxx'
os
.
environ
[
'AR'
]
=
'my_ar'
os
.
environ
[
'ARFLAGS'
]
=
'-arflags'
# make sure AR gets caught
class
compiler
:
...
...
@@ -60,7 +61,7 @@ class SysconfigTestCase(unittest.TestCase):
comp
=
compiler
()
sysconfig
.
customize_compiler
(
comp
)
self
.
assertEquals
(
comp
.
exes
[
'archiver'
],
'
xxx
'
)
self
.
assertEquals
(
comp
.
exes
[
'archiver'
],
'
my_ar -arflags
'
)
def
test_suite
():
...
...
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