Mercurial > wikked
annotate setup.py @ 232:dbc855c585cf
Fixed a bug in the setup script.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 14 Mar 2014 21:41:15 -0700 |
parents | 64c64df08d2a |
children | bcbe934eab29 |
rev | line source |
---|---|
161
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
1 import os |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
2 import os.path |
195
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
3 import time |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
4 import subprocess |
161
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
5 from setuptools import setup, find_packages |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
6 |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
7 |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
8 def read(fname): |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
9 with open(os.path.join(os.path.dirname(__file__), fname)) as fp: |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
10 return fp.read() |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
11 |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
12 |
195
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
13 def runcmd(cmd): |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
14 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
15 stderr=subprocess.PIPE) |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
16 out, err = p.communicate() |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
17 return out, err |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
18 |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
19 |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
20 # Figure out the version. |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
21 # (this is loosely based on what Mercurial does) |
232
dbc855c585cf
Fixed a bug in the setup script.
Ludovic Chabant <ludovic@chabant.com>
parents:
206
diff
changeset
|
22 version = None |
195
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
23 try: |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
24 if os.path.isdir('.hg'): |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
25 cmd = ['hg', 'log', '-r', '.', '--template', '{tags}\n'] |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
26 tags, err = runcmd(cmd) |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
27 versions = [t for t in tags.split() if t[0].isdigit()] |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
28 |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
29 cmd = ['hg', 'id', '-i'] |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
30 hgid, err = runcmd(cmd) |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
31 hgid = hgid.strip() |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
32 |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
33 if versions: |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
34 # Use tag found at the current revision. Add dirty flag if any. |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
35 version = versions[-1] |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
36 if hgid.endswith('+'): |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
37 version += '+' |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
38 else: |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
39 # Use latest tag. |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
40 cmd = ['hg', 'parents', '--template', '{latesttag}+{latesttagdistance}-'] |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
41 version, err = runcmd(cmd) |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
42 version += hgid |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
43 if version.endswith('+'): |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
44 version += time.strftime('%Y%m%d') |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
45 except OSError: |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
46 # Mercurial isn't installed, or not in the PATH. |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
47 version = None |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
48 |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
49 if version: |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
50 f = open("wikked/__version__.py", "w") |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
51 f.write('# this file is autogenerated by setup.py\n') |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
52 f.write('version = "%s"\n' % version) |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
53 f.close() |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
54 |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
55 |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
56 try: |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
57 from wikked import __version__ |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
58 version = __version__.version |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
59 except ImportError: |
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
60 version = 'unknown' |
167
adc70e861804
Some fixes to the Pypi packaging.
Ludovic Chabant <ludovic@chabant.com>
parents:
162
diff
changeset
|
61 |
adc70e861804
Some fixes to the Pypi packaging.
Ludovic Chabant <ludovic@chabant.com>
parents:
162
diff
changeset
|
62 |
161
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
63 setup( |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
64 name='Wikked', |
195
964fd28e9b39
Added automatic versioning.
Ludovic Chabant <ludovic@chabant.com>
parents:
169
diff
changeset
|
65 version=version, |
161
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
66 description=("A wiki engine entirely managed with text files " |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
67 "stored in a revision control system."), |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
68 author='Ludovic Chabant', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
69 author_email='ludovic@chabant.com', |
167
adc70e861804
Some fixes to the Pypi packaging.
Ludovic Chabant <ludovic@chabant.com>
parents:
162
diff
changeset
|
70 url="https://github.com/ludovicchabant/Wikked", |
161
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
71 license="Apache 2.0", |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
72 keywords="wiki mercurial hg git", |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
73 packages=find_packages(exclude=["tests"]), |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
74 install_requires=[ |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
75 'Flask>=0.10', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
76 'Flask-Login>=0.1.3', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
77 'Flask-SQLAlchemy>=1.0', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
78 'Flask-Script>=0.5.1', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
79 'Jinja2>=2.6', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
80 'Markdown>=2.2.1', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
81 'PyYAML>=3.10', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
82 'Pygments>=1.5', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
83 'SQLAlchemy>=0.8.3', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
84 'Werkzeug>=0.8.3', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
85 'Whoosh>=2.4.1', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
86 'argparse>=1.2.1', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
87 'pybars>=0.0.4', |
162
81e39ae8aef0
Fixed missing files from the Pypi package and the production build.
Ludovic Chabant <ludovic@chabant.com>
parents:
161
diff
changeset
|
88 'python-hglib', |
161
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
89 'twill>=0.9', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
90 'wsgiref>=0.1.2' |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
91 ], |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
92 scripts=['wk.py'], |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
93 include_package_data=True, |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
94 package_data={ |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
95 'wikked': [ |
162
81e39ae8aef0
Fixed missing files from the Pypi package and the production build.
Ludovic Chabant <ludovic@chabant.com>
parents:
161
diff
changeset
|
96 'resources/*', |
161
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
97 'templates/*.html', |
206
64c64df08d2a
Package Bootstrap fonts with the rest.
Ludovic Chabant <ludovic@chabant.com>
parents:
205
diff
changeset
|
98 'static/bootstrap/fonts/*', |
161
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
99 'static/css/wikked.min.css', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
100 'static/img/*.png', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
101 'static/js/require.js', |
205
719bcebefd68
No need to package `pagedown` code separately.
Ludovic Chabant <ludovic@chabant.com>
parents:
195
diff
changeset
|
102 'static/js/wikked.min.js' |
161
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
103 ] |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
104 }, |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
105 zip_safe=False, |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
106 classifiers=[ |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
107 'Development Status :: 3 - Alpha', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
108 'License :: OSI Approved :: Apache Software License', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
109 'Environment :: Console', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
110 'Operating System :: MacOS :: MacOS X', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
111 'Operating System :: Unix', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
112 'Operating System :: POSIX', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
113 'Operating System :: Microsoft :: Windows', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
114 'Programming Language :: Python', |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
115 ], |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
116 entry_points={ |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
117 'console_scripts': [ |
169
f1003615a261
Added entry-point info for console scripts.
Ludovic Chabant <ludovic@chabant.com>
parents:
167
diff
changeset
|
118 'wk = wikked.witch:main' |
161
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
119 ] |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
120 }, |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
121 ) |
f307d4cdc3fb
Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
122 |