Mercurial > piecrust2
annotate garcon/pypi.py @ 992:bd269692dbb4
cm: Make the release script commit changed FoodTruck assets if needed.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 12 May 2017 09:01:51 -0700 |
parents | 9231172e3d81 |
children | 112ff1ab110c |
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 |
650
1e543ed2bf38
cm: Tweaks to the release script.
Ludovic Chabant <ludovic@chabant.com>
parents:
648
diff
changeset
|
6 def makerelease(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: |
bd269692dbb4
cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents:
742
diff
changeset
|
34 run('hg commit piecrust/admin/static ' |
bd269692dbb4
cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents:
742
diff
changeset
|
35 '-m "admin: Regenerate FoodTruck assets."') |
bd269692dbb4
cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents:
742
diff
changeset
|
36 |
650
1e543ed2bf38
cm: Tweaks to the release script.
Ludovic Chabant <ludovic@chabant.com>
parents:
648
diff
changeset
|
37 # Submit the CHANGELOG. |
742
9231172e3d81
cm: Add generation of online changelog to the release task.
Ludovic Chabant <ludovic@chabant.com>
parents:
676
diff
changeset
|
38 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
|
39 '-m "cm: Regenerate the CHANGELOG."') |
650
1e543ed2bf38
cm: Tweaks to the release script.
Ludovic Chabant <ludovic@chabant.com>
parents:
648
diff
changeset
|
40 |
1e543ed2bf38
cm: Tweaks to the release script.
Ludovic Chabant <ludovic@chabant.com>
parents:
648
diff
changeset
|
41 # 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
|
42 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
|
43 |
650
1e543ed2bf38
cm: Tweaks to the release script.
Ludovic Chabant <ludovic@chabant.com>
parents:
648
diff
changeset
|
44 # PyPi upload. |
676
a04288f199a5
cm: Don't always generation the version when running `setuptools`.
Ludovic Chabant <ludovic@chabant.com>
parents:
650
diff
changeset
|
45 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
|
46 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
|
47 else: |
992
bd269692dbb4
cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents:
742
diff
changeset
|
48 if commit_assets: |
bd269692dbb4
cm: Make the release script commit changed FoodTruck assets if needed.
Ludovic Chabant <ludovic@chabant.com>
parents:
742
diff
changeset
|
49 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
|
50 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
|
51 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
|
52 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
|
53 |