# HG changeset patch # User Jeff Hammel # Date 1271800307 25200 # Node ID 3f9fac577d75e90be941c478c1c927ca0e1b9ce0 # Parent 95b9f262d79578212bd34df450306c5c4a5bcb76 this now actually makes some tarballs for you diff -r 95b9f262d795 -r 3f9fac577d75 setup.py --- a/setup.py Tue Apr 20 14:15:22 2010 -0700 +++ b/setup.py Tue Apr 20 14:51:47 2010 -0700 @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import sys, os -version = '0.0' +version = '0.1' setup(name='stampit', version=version, diff -r 95b9f262d795 -r 3f9fac577d75 stampit/main.py --- a/stampit/main.py Tue Apr 20 14:15:22 2010 -0700 +++ b/stampit/main.py Tue Apr 20 14:51:47 2010 -0700 @@ -28,6 +28,10 @@ def main(args=sys.argv[1:]): + # XXX this is actually a very long way to work around just getting the + # tarballs as pip magically does this for you! ::sigh:: + # not sure of a better/easier way, though + if 'PYTHONHOME' in os.environ: del os.environ['PYTHONHOME'] # just make sure this is killed @@ -51,10 +55,11 @@ options.name = '+'.join(args) # locate virtualenv - if not options.virtualenv: + if options.virtualenv: + if not os.path.exists(options.virtualenv): + parser.error("'%s', specified by --virtualenv, does not exist") + else: options.virtualenv = which('virtualenv') - if not os.path.exist(options.virtualenv): - parser.error("'%s', specified by --virtualenv, does not exist") if options.virtualenv is None: # TODO: download virtualenv for them parser.error("virtualenv cannot be found; please install virtualenv or specify its location with --virtualenv") @@ -63,18 +68,23 @@ if not options.directory: options.directory = tempfile.mkdtemp(dir=os.getcwd()) call([options.virtualenv, '--no-site-packages', options.directory]) - oldpwd = os.getcwd() - os.chdir(options.directory) # install the packages - bundlename = options.name + '.pybundle' - command = [ 'bin/pip', 'bundle', bundlename ] + pip = os.path.join(options.directory, 'bin', 'pip') + command = [ pip, 'install', '--no-install' ] command.extend(args) call(command) - command = ['bin/pip', 'install', bundlename ] - # get the versions - + # make the tarballs + distdir = os.path.join(options.directory, 'dist') + builddir = os.path.join(options.directory, 'build') # virtualenv creates + os.mkdir(distdir) + python = os.path.join(options.directory, 'bin', 'python') + for package in os.listdir(builddir): + os.chdir(os.path.join(builddir, package)) + call([python, 'setup.py', 'sdist', '--dist-dir', distdir]) + print 'Tarballs are in %s:' % distdir + print '\n'.join(os.listdir(distdir)) if __name__ == '__main__': main() diff -r 95b9f262d795 -r 3f9fac577d75 stampit/utils.py --- a/stampit/utils.py Tue Apr 20 14:15:22 2010 -0700 +++ b/stampit/utils.py Tue Apr 20 14:51:47 2010 -0700 @@ -4,9 +4,9 @@ import os -def which(exectuable): +def which(executable): for directory in os.environ['PATH'].split(os.pathsep): - path = os.path.join(dir, executable) + path = os.path.join(directory, executable) if os.path.exists(path): return path