forked from osilkin98/PyBRY
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
61 lines (47 loc) · 1.64 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
import os
from setuptools import setup
from setuptools.command.build_py import build_py
# This should be replaced by setuptools as distutils is deprecated
from distutils.command.clean import clean
from distutils.dir_util import remove_tree
import generator
from template.constants import __version__
from template.constants import NAME
class GenerateAPILocalJSON(build_py):
"""Generates the API from the local JSON file."""
def run(self):
argv = ["generator", "docs/api.json"]
generator.main(argv)
build_py.run(self)
class GenerateAPIURLJSON(build_py):
"""Generates the API from the JSON file in the online repository."""
def run(self):
generator.main(None)
build_py.run(self)
class Clean(clean):
def run(self):
if os.path.exists(NAME):
remove_tree(NAME)
clean.run(self)
# To read markdown file
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md'), 'r') as outfile:
long_description = outfile.read()
setup(
name=NAME,
url='https://github.com/osilkin98/PyBRY',
author='Oleg Silkin, Beliko R',
author_email='[email protected]',
version=__version__,
packages=[NAME],
license='MIT License',
description="A Binded Python API for the LBRYD and LBRYCRD network",
long_description=long_description,
long_description_content_type='text/markdown',
requires=['yapf'],
python_requires='>=3',
cmdclass={'build_py': GenerateAPILocalJSON,
'build_local': GenerateAPILocalJSON,
'build_online': GenerateAPIURLJSON,
'clean': Clean}
)