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
b4b74e36
Commit
b4b74e36
authored
Apr 12, 2009
by
Tarek Ziadé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added a test for finalize_options
parent
343e5f79
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
command/config.py
command/config.py
+6
-7
tests/test_config_cmd.py
tests/test_config_cmd.py
+15
-0
No files found.
command/config.py
View file @
b4b74e36
...
@@ -12,7 +12,7 @@ this header file lives".
...
@@ -12,7 +12,7 @@ this header file lives".
__revision__
=
"$Id$"
__revision__
=
"$Id$"
import
sys
,
os
,
string
,
re
import
sys
,
os
,
string
,
re
from
types
import
*
from
distutils.core
import
Command
from
distutils.core
import
Command
from
distutils.errors
import
DistutilsExecError
from
distutils.errors
import
DistutilsExecError
from
distutils.sysconfig
import
customize_compiler
from
distutils.sysconfig
import
customize_compiler
...
@@ -68,19 +68,18 @@ class config(Command):
...
@@ -68,19 +68,18 @@ class config(Command):
def
finalize_options
(
self
):
def
finalize_options
(
self
):
if
self
.
include_dirs
is
None
:
if
self
.
include_dirs
is
None
:
self
.
include_dirs
=
self
.
distribution
.
include_dirs
or
[]
self
.
include_dirs
=
self
.
distribution
.
include_dirs
or
[]
elif
type
(
self
.
include_dirs
)
is
StringType
:
elif
isinstance
(
self
.
include_dirs
,
str
)
:
self
.
include_dirs
=
s
tring
.
split
(
self
.
include_dirs
,
os
.
pathsep
)
self
.
include_dirs
=
s
elf
.
include_dirs
.
split
(
os
.
pathsep
)
if
self
.
libraries
is
None
:
if
self
.
libraries
is
None
:
self
.
libraries
=
[]
self
.
libraries
=
[]
elif
type
(
self
.
libraries
)
is
StringType
:
elif
isinstance
(
self
.
libraries
,
str
)
:
self
.
libraries
=
[
self
.
libraries
]
self
.
libraries
=
[
self
.
libraries
]
if
self
.
library_dirs
is
None
:
if
self
.
library_dirs
is
None
:
self
.
library_dirs
=
[]
self
.
library_dirs
=
[]
elif
type
(
self
.
library_dirs
)
is
StringType
:
elif
isinstance
(
self
.
library_dirs
,
str
):
self
.
library_dirs
=
string
.
split
(
self
.
library_dirs
,
os
.
pathsep
)
self
.
library_dirs
=
self
.
library_dirs
.
split
(
os
.
pathsep
)
def
run
(
self
):
def
run
(
self
):
pass
pass
...
...
tests/test_config_cmd.py
View file @
b4b74e36
...
@@ -46,6 +46,21 @@ class ConfigTestCase(support.LoggingSilencer,
...
@@ -46,6 +46,21 @@ class ConfigTestCase(support.LoggingSilencer,
match
=
cmd
.
search_cpp
(
pattern
=
'command'
,
body
=
'// xxx'
)
match
=
cmd
.
search_cpp
(
pattern
=
'command'
,
body
=
'// xxx'
)
self
.
assertEquals
(
match
,
1
)
self
.
assertEquals
(
match
,
1
)
def
test_finalize_options
(
self
):
# finalize_options does a bit of transformation
# on options
pkg_dir
,
dist
=
self
.
create_dist
()
cmd
=
config
(
dist
)
cmd
.
include_dirs
=
'one%stwo'
%
os
.
pathsep
cmd
.
libraries
=
'one'
cmd
.
library_dirs
=
'three%sfour'
%
os
.
pathsep
cmd
.
ensure_finalized
()
self
.
assertEquals
(
cmd
.
include_dirs
,
[
'one'
,
'two'
])
self
.
assertEquals
(
cmd
.
libraries
,
[
'one'
])
self
.
assertEquals
(
cmd
.
library_dirs
,
[
'three'
,
'four'
])
def
test_suite
():
def
test_suite
():
return
unittest
.
makeSuite
(
ConfigTestCase
)
return
unittest
.
makeSuite
(
ConfigTestCase
)
...
...
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