annotate setup.py @ 314:59dd71d4a69a

The `url:` endpoint just returns URLs. The new `asset:` endpoint tries to generate "appropriate" HTML tags and other cleverness for quick handling of the majority cases.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 08 Oct 2014 23:22:02 -0700
parents 9055434ebbd0
children 0698b546e278
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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:
234
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
24 if os.path.isdir(os.path.join(os.path.dirname(__file__), '.hg')):
195
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=[
234
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
75 'Flask==0.10.1',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
76 'Flask-Bcrypt==0.5.2',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
77 'Flask-Login==0.2.10',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
78 'Flask-Script==0.5.1',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
79 'Jinja2==2.7.2',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
80 'Markdown==2.2.1',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
81 'Pygments==1.6',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
82 'SQLAlchemy==0.9.3',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
83 'Whoosh==2.5.5',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
84 'colorama==0.2.7',
241
3580410865fe Fix dependency on broken version of `py-bcrypt`.
Ludovic Chabant <ludovic@chabant.com>
parents: 234
diff changeset
85 'py-bcrypt==0.4',
234
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
86 'pysqlite==2.6.3',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
87 'pytest==2.5.2',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
88 'repoze.lru==0.6',
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
89 'python-hglib'],
161
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
90 include_package_data=True,
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
91 zip_safe=False,
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
92 classifiers=[
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
93 'Development Status :: 3 - Alpha',
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
94 'License :: OSI Approved :: Apache Software License',
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
95 'Environment :: Console',
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
96 'Operating System :: MacOS :: MacOS X',
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
97 'Operating System :: Unix',
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
98 'Operating System :: POSIX',
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
99 'Operating System :: Microsoft :: Windows',
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
100 'Programming Language :: Python',
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 entry_points={
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
103 'console_scripts': [
234
bcbe934eab29 Fixed `setuptools` package:
Ludovic Chabant <ludovic@chabant.com>
parents: 232
diff changeset
104 'wk = wikked.witch:real_main'
161
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
105 ]
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
106 },
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
107 )
f307d4cdc3fb Setup Wikked Pypi package:
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
108