-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
51 lines (41 loc) · 1.48 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
import json
import os
import pathlib
import setuptools
from pdtj import __version__
long_description = (pathlib.Path(__file__).parent / "README.md").read_text()
def get_requirements_from_pipfile_lock(pipfile_lock=None):
if pipfile_lock is None:
pipfile_lock = os.path.join(os.path.dirname(os.path.realpath(__file__)), "Pipfile.lock")
lock_data = json.load(open(pipfile_lock))
retval = []
for package_name, package_data in lock_data.get("default", {}).items():
if package_data.get("file"):
package_ref = f'{package_name} @ {package_data["file"]}'
else:
package_ref = f'{package_name}{package_data["version"]}'
retval.append(package_ref)
return retval
def generate_requirements_txt(pipfile_lock_requirements):
for requirement in pipfile_lock_requirements:
with open(os.path.join("requirements.txt"), "w") as file:
file.writelines(requirement)
requirements = get_requirements_from_pipfile_lock()
generate_requirements_txt(requirements)
setuptools.setup(
name="pdtj",
version="0.3.5",
license="MIT",
author="Joao Paulo Euko",
url="https://github.com/Joaopeuko/pdtj",
keywords=["python", "docstring", "json"],
long_description=long_description,
long_description_content_type="text/markdown",
packages=setuptools.find_packages(),
install_requires=requirements,
entry_points={
"console_scripts": [
"pdtj = pdtj.json_generator:main",
]
},
)