-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
67 lines (55 loc) · 2.12 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
import setuptools
import platform
import stat
import os
import sys
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
# get path for requirements file
parent_folder = os.path.dirname(os.path.realpath(__file__))
requirementPath = os.path.join(parent_folder, 'requirements.txt')
# load requirements
install_requires = []
if os.path.isfile(requirementPath):
with open(requirementPath) as f:
install_requires = f.read().splitlines()
setuptools.setup(
name="sparcscore",
version="1.0.0",
author="Georg Wallmann, Sophia Mädler, Niklas Schmacke",
author_email="[email protected]",
description="SPARCSpy",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/MannLabs/SPARCSpy",
project_urls={
"Bug Tracker": "https://github.com/MannLabs/SPARCSpy",
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
package_dir={"": "src"},
packages=setuptools.find_packages(where="src"),
python_requires=">=3.6",
include_package_data=True,
zip_safe=True,
install_requires=install_requires,
)
if platform.system() == "Linux":
target_folder = "/usr/local/bin"
commands = ["sparcs-stat", "sparcs-split", "sparcs-merge"]
src_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)),"src","sparcscmd")
bin_directory = os.path.dirname(os.path.abspath(sys.executable))
for cmd in commands:
src_module = os.path.join(src_directory,cmd+".py")
symlink_origin = os.path.join(bin_directory,cmd)
# make script executebale
st = os.stat(src_module)
os.chmod(src_module, st.st_mode | 0o111)
if not os.path.islink(symlink_origin):
print(f"symlink for {cmd} does not exist, will be created")
os.symlink(src_module, symlink_origin)
else:
print("Automatic symlinks are only supported on linux. Please add viper cli commands to your PATH.")