-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
77 lines (67 loc) · 2.35 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
70
71
72
73
74
75
76
from setuptools import setup, find_packages
from os.path import join, dirname
from os import environ
from logging import getLogger
from typing import Optional
from textwrap import dedent
logger=getLogger(__name__)
warning=logger.warning
LITREPL_REVISION:Optional[str]
try:
LITREPL_REVISION=environ["LITREPL_REVISION"]
except Exception:
warning("Couldn't read LITREPL_REVISION, trying `git rev-parse`")
try:
from subprocess import check_output
import sys
LITREPL_REVISION=check_output(['git', 'rev-parse', 'HEAD'],
cwd=dirname(__file__)).decode().strip()
except Exception:
warning("Couldn't use `git rev-parse`, no revision metadata will be set")
LITREPL_REVISION=None
LITREPL_SEMVER:Optional[str]
try:
LITREPL_SEMVER=open(join(dirname(__file__),'semver.txt')).read().strip()
except Exception:
warning("Couldn't read 'semver.txt', no metadata will be set")
LITREPL_SEMVER=None
if LITREPL_REVISION:
with open(join('python','litrepl','revision.py'), 'w') as f:
f.write("# AUTOGENERATED by setup.exe!\n")
f.write(f"__revision__ = '{LITREPL_REVISION}'\n")
if LITREPL_SEMVER:
with open(join('python','litrepl','semver.py'), 'w') as f:
f.write("# AUTOGENERATED by setup.exe!\n")
f.write(f"__semver__ = '{LITREPL_SEMVER}'\n")
with open("CHANGELOG.md", "r") as f:
changelog = f.read()
with open("README.md", "r") as f:
readme = f.read()
long_description = dedent(f'''
{changelog}
{readme}
''')
setup(
name="litrepl",
zip_safe=False, # https://mypy.readthedocs.io/en/latest/installed_packages.html
version=LITREPL_SEMVER if LITREPL_SEMVER else "999",
package_dir={'':'python'},
packages=find_packages(where='python'),
long_description=long_description,
long_description_content_type="text/markdown",
install_requires=['lark', 'psutil'],
scripts=['./python/bin/litrepl'],
python_requires='>=3.6',
author="Sergei Mironov",
author_email="[email protected]",
url='https://github.com/sergei-mironov/litrepl',
description="Litrepl evaluates code from LaTeX/Markdown verbatim sections.",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Topic :: Software Development :: Build Tools",
"Intended Audience :: Developers",
"Development Status :: 3 - Alpha",
],
)