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