-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
83 lines (77 loc) · 2.99 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
77
78
79
80
81
82
83
from setuptools import setup
import os
import sys
import tempfile
import shutil
import subprocess
added_files = []
size_list = ['32', '48', '64', '72', '96', '128', '256', '512']
if 'linux' in sys.platform or 'freebsd' in sys.platform or 'openbsd' in sys.platform:
# Generate directory for icons
temp_dir_obj = tempfile.TemporaryDirectory("tor-util-icons")
temp_dir = temp_dir_obj.name + "/"
subdir = ""
# Icons
print(os.path.abspath(os.path.curdir))
for size in size_list:
subdir = temp_dir + size
in_file = 'desktop/tor-util-' + size + '.png'
os.mkdir(subdir)
shutil.copy(in_file, subdir + '/tor-util.png')
out_dir = 'share/icons/hicolor/' + size + "x" + size + "/apps/"
entry = (out_dir, [subdir + '/tor-util.png'] )
added_files.append(entry)
added_files.append(('share/tor-util/' , ['tor_util.ui']))
added_files.append(('share/applications/', ['desktop/tor_util.desktop']))
added_files.append(('share/man/man1/' , ['man/tor_util_cli.1']))
added_files.append(('share/bash-completion/completions/', ['bash-completion/tor_util_cli.py']))
elif 'win' in sys.platform:
raise TypeError("Windows support not written yet")
elif 'darwin' in sys.platform:
raise TypeError("Apple support not written yet")
else:
raise TypeError("OS " + sys.platform + " not supported!")
#read from requirements.txt
f = open('requirements.txt','r')
dep_list = []
for item in f.readlines():
item = item.rstrip('\n')
dep_list.append(item)
f.close()
setup(name='tor_util',
version='0.1.4',
description='Utility for controling TOR via the API',
author='GI Jack',
author_email='[email protected]',
url='https://github.com/GIJack/tor-util',
packages=['tor_util'],
license='GPLv3',
scripts=['tor_util_cli.py', 'tor_util_gui.py'],
data_files=added_files,
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Environment :: X11 Applications :: Qt',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Operating System :: POSIX :: Linux',
'Operating System :: POSIX :: BSD :: FreeBSD',
'Operating System :: POSIX :: BSD :: OpenBSD',
#'Operating System :: MacOS :: MacOS X',
#'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python :: 3',
'Topic :: Utilities',
'Topic :: System :: Networking',
],
install_requires = dep_list
)
# Clean Up temp files
if 'linux' in sys.platform or 'freebsd' in sys.platform or 'openbsd' in sys.platform:
temp_dir_obj.cleanup()
elif 'win' in sys.platform:
raise TypeError("Windows support not written yet")
elif 'darwin' in sys.platform:
raise TypeError("Apple support not written yet")
else:
raise TypeError("OS " + sys.platform + " not supported!")