changeset 5:3f9fac577d75

this now actually makes some tarballs for you
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 20 Apr 2010 14:51:47 -0700
parents 95b9f262d795
children 6f8f390ab0b4
files setup.py stampit/main.py stampit/utils.py
diffstat 3 files changed, 23 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- 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,
--- 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()
--- 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