diff garcon/pypi.py @ 1005:2e5c5d33d62c

Merge changes.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 21 Nov 2017 22:07:12 -0800
parents 22cf13b86cc3 112ff1ab110c
children a013a3bea22a
line wrap: on
line diff
--- a/garcon/pypi.py	Tue Nov 21 21:30:37 2017 -0800
+++ b/garcon/pypi.py	Tue Nov 21 22:07:12 2017 -0800
@@ -1,3 +1,4 @@
+import re
 from invoke import task, run
 
 
@@ -14,12 +15,29 @@
     print("Generating FoodTruck assets")
     run("gulp")
 
+    # See if any asset was modified and needs to be submitted.
+    r = run('hg status', hide=True)
+    if re.match(r'^[R\!] ', r.stdout):
+        raise Exception("FoodTruck assets are missing or were removed!")
+
+    commit_assets = False
+    if re.match(r'^[MA] ', r.stdout):
+        commit_assets = True
+
     # CHANGELOG.rst and documentation changelog page.
     run("invoke changelog --last %s" % version)
     run("invoke changelog --last %s -o docs/pages/support/changelog.md" %
             version)
 
     if not local_only:
+        if commit_assets:
+            res = run('hg status piecrust/admin/static')
+            if not res:
+                return
+            if res.stdout.strip() != '':
+                run('hg commit piecrust/admin/static '
+                    '-m "admin: Regenerate FoodTruck assets."')
+
         # Submit the CHANGELOG.
         run('hg commit CHANGELOG.rst docs/pages/support/changelog.md '
             '-m "cm: Regenerate the CHANGELOG."')
@@ -31,6 +49,8 @@
         run("python setup.py version")
         run("python setup.py sdist upload")
     else:
+        if commit_assets:
+            print("Would submit FoodTruck assets...")
         print("Would submit changelog files...")
         print("Would tag repo with %s..." % version)
         print("Would upload to PyPi...")