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
08842023
Commit
08842023
authored
Jul 03, 2009
by
Tarek Ziadé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #6403 : package path usage for build_ext
parent
d25aae0d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
10 deletions
+41
-10
command/build_ext.py
command/build_ext.py
+10
-4
tests/test_build_ext.py
tests/test_build_ext.py
+31
-6
No files found.
command/build_ext.py
View file @
08842023
...
@@ -644,17 +644,23 @@ class build_ext (Command):
...
@@ -644,17 +644,23 @@ class build_ext (Command):
"""
"""
fullname
=
self
.
get_ext_fullname
(
ext_name
)
fullname
=
self
.
get_ext_fullname
(
ext_name
)
modpath
=
fullname
.
split
(
'.'
)
modpath
=
fullname
.
split
(
'.'
)
package
=
'.'
.
join
(
modpath
[
0
:
-
1
])
filename
=
self
.
get_ext_filename
(
modpath
[
-
1
])
base
=
modpath
[
-
1
]
filename
=
self
.
get_ext_filename
(
base
)
if
not
self
.
inplace
:
if
not
self
.
inplace
:
# no further work needed
# no further work needed
# returning :
# build_dir/package/path/filename
filename
=
os
.
path
.
join
(
*
modpath
[:
-
1
]
+
[
filename
])
return
os
.
path
.
join
(
self
.
build_lib
,
filename
)
return
os
.
path
.
join
(
self
.
build_lib
,
filename
)
# the inplace option requires to find the package directory
# the inplace option requires to find the package directory
# using the build_py command
# using the build_py command for that
package
=
'.'
.
join
(
modpath
[
0
:
-
1
])
build_py
=
self
.
get_finalized_command
(
'build_py'
)
build_py
=
self
.
get_finalized_command
(
'build_py'
)
package_dir
=
os
.
path
.
abspath
(
build_py
.
get_package_dir
(
package
))
package_dir
=
os
.
path
.
abspath
(
build_py
.
get_package_dir
(
package
))
# returning
# package_dir/filename
return
os
.
path
.
join
(
package_dir
,
filename
)
return
os
.
path
.
join
(
package_dir
,
filename
)
def
get_ext_fullname
(
self
,
ext_name
):
def
get_ext_fullname
(
self
,
ext_name
):
...
...
tests/test_build_ext.py
View file @
08842023
...
@@ -337,7 +337,8 @@ class BuildExtTestCase(support.TempdirManager,
...
@@ -337,7 +337,8 @@ class BuildExtTestCase(support.TempdirManager,
self
.
assertEquals
(
so_dir
,
cmd
.
build_lib
)
self
.
assertEquals
(
so_dir
,
cmd
.
build_lib
)
# inplace = 0, cmd.package = 'bar'
# inplace = 0, cmd.package = 'bar'
cmd
.
package
=
'bar'
build_py
=
cmd
.
get_finalized_command
(
'build_py'
)
build_py
.
package_dir
=
{
''
:
'bar'
}
path
=
cmd
.
get_ext_fullpath
(
'foo'
)
path
=
cmd
.
get_ext_fullpath
(
'foo'
)
# checking that the last directory is the build_dir
# checking that the last directory is the build_dir
path
=
os
.
path
.
split
(
path
)[
0
]
path
=
os
.
path
.
split
(
path
)[
0
]
...
@@ -355,12 +356,14 @@ class BuildExtTestCase(support.TempdirManager,
...
@@ -355,12 +356,14 @@ class BuildExtTestCase(support.TempdirManager,
# checking that the last directory is bar
# checking that the last directory is bar
path
=
os
.
path
.
split
(
path
)[
0
]
path
=
os
.
path
.
split
(
path
)[
0
]
lastdir
=
os
.
path
.
split
(
path
)[
-
1
]
lastdir
=
os
.
path
.
split
(
path
)[
-
1
]
self
.
assertEquals
(
lastdir
,
cmd
.
package
)
self
.
assertEquals
(
lastdir
,
'bar'
)
def
test_build_ext_inplace
(
self
):
def
test_ext_fullpath
(
self
):
etree_c
=
os
.
path
.
join
(
self
.
tmp_dir
,
'lxml.etree.c'
)
# building lxml.etree inplace
etree_ext
=
Extension
(
'lxml.etree'
,
[
etree_c
])
#etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c')
dist
=
Distribution
({
'name'
:
'lxml'
,
'ext_modules'
:
[
etree_ext
]})
#etree_ext = Extension('lxml.etree', [etree_c])
#dist = Distribution({'name': 'lxml', 'ext_modules': [etree_ext]})
dist
=
Distribution
()
cmd
=
build_ext
(
dist
)
cmd
=
build_ext
(
dist
)
cmd
.
inplace
=
1
cmd
.
inplace
=
1
cmd
.
distribution
.
package_dir
=
{
''
:
'src'
}
cmd
.
distribution
.
package_dir
=
{
''
:
'src'
}
...
@@ -370,6 +373,28 @@ class BuildExtTestCase(support.TempdirManager,
...
@@ -370,6 +373,28 @@ class BuildExtTestCase(support.TempdirManager,
path
=
cmd
.
get_ext_fullpath
(
'lxml.etree'
)
path
=
cmd
.
get_ext_fullpath
(
'lxml.etree'
)
self
.
assertEquals
(
wanted
,
path
)
self
.
assertEquals
(
wanted
,
path
)
# building lxml.etree not inplace
cmd
.
inplace
=
0
cmd
.
build_lib
=
os
.
path
.
join
(
curdir
,
'tmpdir'
)
wanted
=
os
.
path
.
join
(
curdir
,
'tmpdir'
,
'lxml'
,
'etree.so'
)
path
=
cmd
.
get_ext_fullpath
(
'lxml.etree'
)
self
.
assertEquals
(
wanted
,
path
)
# building twisted.runner.portmap not inplace
build_py
=
cmd
.
get_finalized_command
(
'build_py'
)
build_py
.
package_dir
=
{}
cmd
.
distribution
.
packages
=
[
'twisted'
,
'twisted.runner.portmap'
]
path
=
cmd
.
get_ext_fullpath
(
'twisted.runner.portmap'
)
wanted
=
os
.
path
.
join
(
curdir
,
'tmpdir'
,
'twisted'
,
'runner'
,
'portmap.so'
)
self
.
assertEquals
(
wanted
,
path
)
# building twisted.runner.portmap inplace
cmd
.
inplace
=
1
path
=
cmd
.
get_ext_fullpath
(
'twisted.runner.portmap'
)
wanted
=
os
.
path
.
join
(
curdir
,
'twisted'
,
'runner'
,
'portmap.so'
)
self
.
assertEquals
(
wanted
,
path
)
def
test_suite
():
def
test_suite
():
src
=
_get_source_filename
()
src
=
_get_source_filename
()
if
not
os
.
path
.
exists
(
src
):
if
not
os
.
path
.
exists
(
src
):
...
...
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