-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
executable file
·69 lines (64 loc) · 2.42 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# encoding: utf-8
# SEE: https://packaging.python.org/en/latest/distributing.html#id23
# SEE: https://pythonhosted.org/setuptools/setuptools.html
# --
# Create source distribution: python setup.py sdist
# Upload using twine: twine upload dist/*
# Upload using setup.py: setup.py sdist bdist_wheel upload
try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
import sys, os, tempfile
# We make sure `build_libparsing` is within the path
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "bin"))
VERSION = "0.9.3"
if os.path.exists("src/h/parsing.h"):
LONG_DESCRIPTION = "\n".join(_[2:].strip() for _ in open("src/h/parsing.h").read().split("[START:INTRO]",1)[1].split("[END:INTRO]")[0].split("\n"))
else:
LONG_DESCRIPTION = ""
# If pandoc is installed, we translate the documentation to RST. This is really
# only useful for publishing, not for building.
if LONG_DESCRIPTION and os.popen("which pandoc").read():
p = tempfile.mktemp()
with open(p,"w") as f: f.write(LONG_DESCRIPTION)
LONG_DESCRIPTION = os.popen("pandoc -f markdown -t rst %s" % (p)).read()
os.unlink(p)
setup(
name = "libparsing",
version = VERSION,
url = "https://github.com/sebastien/libparsing",
# download_url = "",
author = 'Sébastien Pierre',
author_email = '[email protected]',
license = 'BSD',
description = "Python wrapper for libparsing, a PEG-based parsing library written in C",
keywords = "parsing PEG grammar libparsing",
long_description = LONG_DESCRIPTION,
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
],
packages = ["libparsing"],
package_dir = {"libparsing":"src/python/libparsing"},
package_data ={
"libparsing":[
"_libparsing.c",
"_libparsing.h",
"_libparsing.ffi",
"_buildext.py",
]
},
# SEE: http://cffi.readthedocs.io/en/latest/cdef.html?highlight=setup.py
setup_requires=["cffi>=1.9.1"],
cffi_modules=["src/python/libparsing/_buildext.py:FFI_BUILDER"],
install_requires=["cffi>=1.9.1"],
)
# EOF