comparison garcon/pypi.py @ 1070:a013a3bea22a

cm: Upgrade release script.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 13 Feb 2018 23:37:59 -0800
parents 2e5c5d33d62c
children
comparison
equal deleted inserted replaced
1069:dff873f11541 1070:a013a3bea22a
1 import os.path
1 import re 2 import re
3 import shutil
2 from invoke import task, run 4 from invoke import task, run
3 5
4 6
5 @task 7 @task
6 def makerelease(ctx, version, local_only=False): 8 def makerelease(ctx, version, local_only=False):
8 raise Exception("You must specify a version!") 10 raise Exception("You must specify a version!")
9 11
10 # FoodTruck assets. 12 # FoodTruck assets.
11 print("Update node modules") 13 print("Update node modules")
12 run("npm install") 14 run("npm install")
13 print("Install Bower components")
14 run("bower install")
15 print("Generating FoodTruck assets") 15 print("Generating FoodTruck assets")
16 run("gulp") 16 run("gulp")
17 17
18 # See if any asset was modified and needs to be submitted. 18 # See if any asset was modified and needs to be submitted.
19 r = run('hg status', hide=True) 19 r = run('hg status', hide=True)
25 commit_assets = True 25 commit_assets = True
26 26
27 # CHANGELOG.rst and documentation changelog page. 27 # CHANGELOG.rst and documentation changelog page.
28 run("invoke changelog --last %s" % version) 28 run("invoke changelog --last %s" % version)
29 run("invoke changelog --last %s -o docs/pages/support/changelog.md" % 29 run("invoke changelog --last %s -o docs/pages/support/changelog.md" %
30 version) 30 version)
31
32 # Clean `dist` folder before running setuptools.
33 dist_dir = os.path.join(
34 os.path.dirname(os.path.dirname(__file__)),
35 'dist')
36 if os.path.isdir(dist_dir):
37 print("Removing %s" % dist_dir)
38 shutil.rmtree(dist_dir)
31 39
32 if not local_only: 40 if not local_only:
33 if commit_assets: 41 if commit_assets:
34 res = run('hg status piecrust/admin/static') 42 res = run('hg status piecrust/admin/static')
35 if not res: 43 if not res:
45 # Tag in Mercurial, which will then be used for PyPi version. 53 # Tag in Mercurial, which will then be used for PyPi version.
46 run("hg tag %s" % version) 54 run("hg tag %s" % version)
47 55
48 # PyPi upload. 56 # PyPi upload.
49 run("python setup.py version") 57 run("python setup.py version")
50 run("python setup.py sdist upload") 58 run("python setup.py sdist bdist_wheel")
59 run("twine upload dist/*")
51 else: 60 else:
52 if commit_assets: 61 if commit_assets:
53 print("Would submit FoodTruck assets...") 62 print("Would submit FoodTruck assets...")
54 print("Would submit changelog files...") 63 print("Would submit changelog files...")
55 print("Would tag repo with %s..." % version) 64 print("Would tag repo with %s..." % version)