Commits

Kirill Simonov  committed 231fb6e

`job pypi`: use source packages generated by `job pkg-src`.

  • Participants
  • Parent commits fa4825b

Comments (0)

Files changed (2)

File tool/dist.py

 
 
 @job
-def pypi():
-    """build the source distribution and upload it to PyPI
-
-    This job builds `zip` and `tar.gz` source distributions and
-    uploads them to PyPI.
-    """
-    setup_py("sdist --formats=zip,gztar --dist-dir=build/dist"
-             " register upload --sign --identity=8E70D862")
-    log()
-    log("Source distribution archives are uploaded to:")
-    log("  `http://pypi.python.org/pypi/HTSQL/`")
-    log()
-
-
-@job
 def clean():
     """delete generated files
 
 
 from job import job, log, debug, fatal, warn, run, rmtree, mktree, pipe
 from vm import LinuxBenchVM, WindowsBenchVM, DATA_ROOT, CTL_DIR
+from dist import setup_py
 import os, glob, re
 
 KEYSIG = '8E70D862' # identifier for HTSQL package signing key
         log("  `%s`" % filename)
     log()
 
+
 class Packager(object):
 
     def __init__(self, vm):
         log("  %s/`%s`" % (self.build_path, self.build_file))
         log()
 
+
 class DEB_Packager(Packager):
 
     def __init__(self):
     packager = DEB_Packager()
     packager()
 
+
 class RPM_Packager(Packager):
 
     def __init__(self):
     """
     packager = RPM_Packager()
     packager()
+
+
+@job
+def pypi():
+    """upload the source distribution to PyPI
+
+    This job uploads `zip` and `tar.gz` source distributions
+    to PyPI.  The distributions must be already built with
+    `job pkg-src`.
+    """
+    if not (glob.glob("./build/pkg/src/HTSQL-*.tar.gz") and
+            glob.glob("./build/pkg/src/HTSQL-*.zip")):
+        raise fatal("cannot find a source package; run `job pkg-src` first")
+    setup_py("sdist --formats=zip,gztar --dist-dir=build/pkg/src --dry-run"
+             " register upload --sign --identity="+KEYSIG)
+    log()
+    log("Source distribution archives are uploaded to:")
+    log("  `http://pypi.python.org/pypi/HTSQL/`")
+    log()
+
+