annotate garcon/pypi.py @ 1051:971b4d67e82a

serve: Fix problems with assets disappearing between servings. When an asset file changes, its source's pipeline is re-run. But that created a bake record that only had that pipeline's output, so the other outputs were incorrectly considered empty and therefore any stray files were removed. Now we copy over bake records for the pipelines we don't run.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 26 Jan 2018 18:05:02 -0800
parents 2e5c5d33d62c
children a013a3bea22a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
992
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
1 import re
642
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
2 from invoke import task, run
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
3
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
4
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
5 @task
990
22cf13b86cc3 cm: Upgrade Garcon tasks to the latest PyInvoke version.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
6 def makerelease(ctx, version, local_only=False):
642
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
7 if not version:
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
8 raise Exception("You must specify a version!")
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
9
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
10 # FoodTruck assets.
648
1696f0a41cfc cm: Update npm modules and bower packages before making a release.
Ludovic Chabant <ludovic@chabant.com>
parents: 642
diff changeset
11 print("Update node modules")
1696f0a41cfc cm: Update npm modules and bower packages before making a release.
Ludovic Chabant <ludovic@chabant.com>
parents: 642
diff changeset
12 run("npm install")
1696f0a41cfc cm: Update npm modules and bower packages before making a release.
Ludovic Chabant <ludovic@chabant.com>
parents: 642
diff changeset
13 print("Install Bower components")
1696f0a41cfc cm: Update npm modules and bower packages before making a release.
Ludovic Chabant <ludovic@chabant.com>
parents: 642
diff changeset
14 run("bower install")
1696f0a41cfc cm: Update npm modules and bower packages before making a release.
Ludovic Chabant <ludovic@chabant.com>
parents: 642
diff changeset
15 print("Generating FoodTruck assets")
642
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
16 run("gulp")
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
17
992
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
18 # See if any asset was modified and needs to be submitted.
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
19 r = run('hg status', hide=True)
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
20 if re.match(r'^[R\!] ', r.stdout):
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
21 raise Exception("FoodTruck assets are missing or were removed!")
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
22
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
23 commit_assets = False
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
24 if re.match(r'^[MA] ', r.stdout):
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
25 commit_assets = True
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
26
742
9231172e3d81 cm: Add generation of online changelog to the release task.
Ludovic Chabant <ludovic@chabant.com>
parents: 676
diff changeset
27 # CHANGELOG.rst and documentation changelog page.
642
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
28 run("invoke changelog --last %s" % version)
742
9231172e3d81 cm: Add generation of online changelog to the release task.
Ludovic Chabant <ludovic@chabant.com>
parents: 676
diff changeset
29 run("invoke changelog --last %s -o docs/pages/support/changelog.md" %
9231172e3d81 cm: Add generation of online changelog to the release task.
Ludovic Chabant <ludovic@chabant.com>
parents: 676
diff changeset
30 version)
642
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
31
650
1e543ed2bf38 cm: Tweaks to the release script.
Ludovic Chabant <ludovic@chabant.com>
parents: 648
diff changeset
32 if not local_only:
992
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
33 if commit_assets:
1001
112ff1ab110c cm: Only commit admin assets if they have changed.
Ludovic Chabant <ludovic@chabant.com>
parents: 992
diff changeset
34 res = run('hg status piecrust/admin/static')
112ff1ab110c cm: Only commit admin assets if they have changed.
Ludovic Chabant <ludovic@chabant.com>
parents: 992
diff changeset
35 if not res:
112ff1ab110c cm: Only commit admin assets if they have changed.
Ludovic Chabant <ludovic@chabant.com>
parents: 992
diff changeset
36 return
112ff1ab110c cm: Only commit admin assets if they have changed.
Ludovic Chabant <ludovic@chabant.com>
parents: 992
diff changeset
37 if res.stdout.strip() != '':
112ff1ab110c cm: Only commit admin assets if they have changed.
Ludovic Chabant <ludovic@chabant.com>
parents: 992
diff changeset
38 run('hg commit piecrust/admin/static '
112ff1ab110c cm: Only commit admin assets if they have changed.
Ludovic Chabant <ludovic@chabant.com>
parents: 992
diff changeset
39 '-m "admin: Regenerate FoodTruck assets."')
992
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
40
650
1e543ed2bf38 cm: Tweaks to the release script.
Ludovic Chabant <ludovic@chabant.com>
parents: 648
diff changeset
41 # Submit the CHANGELOG.
742
9231172e3d81 cm: Add generation of online changelog to the release task.
Ludovic Chabant <ludovic@chabant.com>
parents: 676
diff changeset
42 run('hg commit CHANGELOG.rst docs/pages/support/changelog.md '
9231172e3d81 cm: Add generation of online changelog to the release task.
Ludovic Chabant <ludovic@chabant.com>
parents: 676
diff changeset
43 '-m "cm: Regenerate the CHANGELOG."')
650
1e543ed2bf38 cm: Tweaks to the release script.
Ludovic Chabant <ludovic@chabant.com>
parents: 648
diff changeset
44
1e543ed2bf38 cm: Tweaks to the release script.
Ludovic Chabant <ludovic@chabant.com>
parents: 648
diff changeset
45 # Tag in Mercurial, which will then be used for PyPi version.
642
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
46 run("hg tag %s" % version)
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
47
650
1e543ed2bf38 cm: Tweaks to the release script.
Ludovic Chabant <ludovic@chabant.com>
parents: 648
diff changeset
48 # PyPi upload.
676
a04288f199a5 cm: Don't always generation the version when running `setuptools`.
Ludovic Chabant <ludovic@chabant.com>
parents: 650
diff changeset
49 run("python setup.py version")
642
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
50 run("python setup.py sdist upload")
742
9231172e3d81 cm: Add generation of online changelog to the release task.
Ludovic Chabant <ludovic@chabant.com>
parents: 676
diff changeset
51 else:
992
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
52 if commit_assets:
bd269692dbb4 cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents: 742
diff changeset
53 print("Would submit FoodTruck assets...")
742
9231172e3d81 cm: Add generation of online changelog to the release task.
Ludovic Chabant <ludovic@chabant.com>
parents: 676
diff changeset
54 print("Would submit changelog files...")
9231172e3d81 cm: Add generation of online changelog to the release task.
Ludovic Chabant <ludovic@chabant.com>
parents: 676
diff changeset
55 print("Would tag repo with %s..." % version)
9231172e3d81 cm: Add generation of online changelog to the release task.
Ludovic Chabant <ludovic@chabant.com>
parents: 676
diff changeset
56 print("Would upload to PyPi...")
642
79aefe82c6b6 cm: Move all scripts into a `garcon` package with `invoke` support.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
57