[py-svn] r23231 - py/dist/py/misc
jan at codespeak.net
jan at codespeak.net
Sat Feb 11 17:34:13 CET 2006
Author: jan
Date: Sat Feb 11 17:34:11 2006
New Revision: 23231
Modified:
py/dist/py/misc/dynpkg.py
Log:
use docutils to get the right build/lib... directory
Modified: py/dist/py/misc/dynpkg.py
==============================================================================
--- py/dist/py/misc/dynpkg.py (original)
+++ py/dist/py/misc/dynpkg.py Sat Feb 11 17:34:11 2006
@@ -10,7 +10,7 @@
debug=py.log.STDOUT,
command=None) # py.log.STDOUT)
-from distutils import util
+import distutils.core
class DistPython:
def __init__(self, location=None, python=None):
@@ -20,7 +20,6 @@
if location is None:
location = py.path.local()
self.location = location
- self.plat_specifier = '.%s-%s' % (util.get_platform(), sys.version[0:3])
def clean(self):
out = self._exec("clean -a")
@@ -42,28 +41,24 @@
return out
def get_package_path(self, pkgname):
- pkg = self._get_package_path(pkgname)
- if pkg is None:
+ path = self._get_package_path(pkgname)
+ if not path.check(exists=True):
#self.clean()
self.build()
- pkg = self._get_package_path(pkgname)
- assert pkg is not None
- return pkg
+ path = self._get_package_path(pkgname)
+ print path
+ assert path.check(exists=1)
+ return path
def _get_package_path(self, pkgname):
- major, minor = py.std.sys.version_info[:2]
- #assert major >=2 and minor in (3,4,5)
- suffix = "%s.%s" %(major, minor)
- location = self.location
- for base in [location.join('build', 'lib'),
- location.join('build', 'lib'+ self.plat_specifier)]:
- if base.check(dir=1):
- for pkg in base.visit(lambda x: x.check(dir=1)):
- if pkg.basename == pkgname:
- #
- if pkg.dirpath().basename == 'lib'+ self.plat_specifier or \
- pkg.dirpath().basename == 'lib':
- return pkg
+ # process all config files and commandline args
+ dist = distutils.core.run_setup(self.location.join('setup.py').strpath,
+ script_args=['-q', 'build'],
+ stop_after='commandline')
+ create_if_necessary = True
+ build_command = dist.get_command_obj('build', create_if_necessary)
+ build_command.ensure_finalized()
+ return self.location.join(build_command.build_lib, pkgname)
def setpkg(finalpkgname, distdir):
assert distdir.check(dir=1)
More information about the pytest-commit
mailing list