|
1 #@PydevCodeAnalysisIgnore |
|
2 import sys |
|
3 import os |
|
4 |
|
5 extra = {} |
|
6 if sys.version_info >= (3, 0): |
|
7 extra.update(use_2to3=True) |
|
8 |
|
9 |
|
10 try: |
|
11 from setuptools import setup, find_packages |
|
12 except ImportError: |
|
13 from distutils.core import setup, find_packages |
|
14 |
|
15 |
|
16 # -*- Distribution Meta -*- |
|
17 import re |
|
18 re_meta = re.compile(r'__(\w+?)__\s*=\s*(.*)') |
|
19 re_vers = re.compile(r'VERSION\s*=\s*\((.*?)\)') |
|
20 re_doc = re.compile(r'^"""(.+?)"""', re.M|re.S) |
|
21 rq = lambda s: s.strip("\"'") |
|
22 |
|
23 |
|
24 def add_default(m): |
|
25 attr_name, attr_value = m.groups() |
|
26 return ((attr_name, rq(attr_value)), ) |
|
27 |
|
28 |
|
29 def add_version(m): |
|
30 v = list(map(rq, m.groups()[0].split(", "))) |
|
31 return (("VERSION", ".".join(v[0:3]) + "".join(v[3:])), ) |
|
32 |
|
33 |
|
34 def add_doc(m): |
|
35 return (("doc", m.groups()[0].replace("\n", " ")), ) |
|
36 |
|
37 pats = {re_meta: add_default, |
|
38 re_vers: add_version} |
|
39 here = os.path.abspath(os.path.dirname(__file__)) |
|
40 meta_fh = open(os.path.join(here, "iri_tweet/__init__.py")) |
|
41 try: |
|
42 meta = {} |
|
43 acc = [] |
|
44 for line in meta_fh: |
|
45 if line.strip() == '# -eof meta-': |
|
46 break |
|
47 acc.append(line) |
|
48 for pattern, handler in pats.items(): |
|
49 m = pattern.match(line.strip()) |
|
50 if m: |
|
51 meta.update(handler(m)) |
|
52 m = re_doc.match("".join(acc).strip()) |
|
53 if m: |
|
54 meta.update(add_doc(m)) |
|
55 finally: |
|
56 meta_fh.close() |
|
57 |
|
58 |
|
59 setup(name='iri_tweet', |
|
60 version=meta["VERSION"], |
|
61 description=meta["doc"], |
|
62 long_description=open("README").read(), |
|
63 classifiers=[ |
|
64 'License :: OSI Approved :: BSD License', |
|
65 'Intended Audience :: Developers', |
|
66 'Programming Language :: Python :: 2.6', |
|
67 'Programming Language :: Python :: 2.7', |
|
68 ], |
|
69 keywords='twitter', |
|
70 author=meta["author"], |
|
71 author_email=meta["contact"], |
|
72 url=meta["homepage"], |
|
73 license='BSD, CECCIL-C', |
|
74 packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), |
|
75 include_package_data=True, |
|
76 zip_safe=False, |
|
77 platforms=["any"], |
|
78 install_requires=[], |
|
79 **extra |
|
80 ) |