summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/build_ext.py
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-05-19 16:17:21 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-05-19 16:17:21 (GMT)
commit7d7127dd84189bf9325ef3fc5f3c18359fa34f30 (patch)
tree0a2d4d21cee7370a1b7c76f04060171a7daf9154 /Lib/distutils/command/build_ext.py
parentf03c42f0ab4b4fc0705e2717a89af1254820fed3 (diff)
downloadcpython-7d7127dd84189bf9325ef3fc5f3c18359fa34f30.zip
cpython-7d7127dd84189bf9325ef3fc5f3c18359fa34f30.tar.gz
cpython-7d7127dd84189bf9325ef3fc5f3c18359fa34f30.tar.bz2
fixed the 'package' option of build_ext
Diffstat (limited to 'Lib/distutils/command/build_ext.py')
-rw-r--r--Lib/distutils/command/build_ext.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index 0c77aaa..293c214 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -642,19 +642,21 @@ class build_ext (Command):
The file is located in `build_lib` or directly in the package
(inplace option).
"""
- if self.inplace:
- fullname = self.get_ext_fullname(ext_name)
- modpath = fullname.split('.')
- package = '.'.join(modpath[0:-1])
- base = modpath[-1]
- build_py = self.get_finalized_command('build_py')
- package_dir = os.path.abspath(build_py.get_package_dir(package))
- filename = self.get_ext_filename(ext_name)
- return os.path.join(package_dir, filename)
- else:
- filename = self.get_ext_filename(ext_name)
+ fullname = self.get_ext_fullname(ext_name)
+ filename = self.get_ext_filename(fullname)
+ if not self.inplace:
+ # no further work needed
return os.path.join(self.build_lib, filename)
+ # the inplace option requires to find the package directory
+ # using the build_py command
+ modpath = fullname.split('.')
+ package = '.'.join(modpath[0:-1])
+ base = modpath[-1]
+ build_py = self.get_finalized_command('build_py')
+ package_dir = os.path.abspath(build_py.get_package_dir(package))
+ return os.path.join(package_dir, filename)
+
def get_ext_fullname(self, ext_name):
"""Returns the fullname of a given extension name.