forked from pritunl/pritunl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
145 lines (133 loc) · 4.69 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
from setuptools import setup
import os
import sys
import copy
import shlex
import shutil
import fileinput
VERSION = '1.21.945.14'
PATCH_DIR = 'build'
install_upstart = True
install_systemd = True
install_sysvinit = False
prefix = sys.prefix
for arg in copy.copy(sys.argv):
if arg.startswith('--prefix'):
prefix = os.path.normpath(shlex.split(arg)[0].split('=')[-1])
elif arg == '--no-upstart':
sys.argv.remove('--no-upstart')
install_upstart = False
elif arg == '--no-systemd':
sys.argv.remove('--no-systemd')
install_systemd = False
elif arg == '--sysvinit':
sys.argv.remove('--sysvinit')
install_sysvinit = True
if not os.path.exists('build'):
os.mkdir('build')
main_css_path = os.path.join('www/vendor/dist/css',
os.listdir('www/vendor/dist/css')[0])
main_js_path = os.path.join('www/vendor/dist/js',
sorted(os.listdir('www/vendor/dist/js'))[0])
data_files = [
('/etc', ['data/etc/pritunl.conf']),
('/var/log', [
'data/var/pritunl.log',
'data/var/pritunl.log.1',
]),
('/usr/share/pritunl/www', [
'www/dbconf.html',
'www/key_view.html',
'www/key_view_dark.html',
'www/login.html',
'www/upgrade.html',
'www/vendor/dist/favicon.ico',
'www/vendor/dist/index.html',
'www/vendor/dist/robots.txt',
]),
('/usr/share/pritunl/www/css', [main_css_path]),
('/usr/share/pritunl/www/fonts', [
'www/vendor/dist/fonts/FontAwesome.otf',
'www/vendor/dist/fonts/fontawesome-webfont.eot',
'www/vendor/dist/fonts/fontawesome-webfont.svg',
'www/vendor/dist/fonts/fontawesome-webfont.ttf',
'www/vendor/dist/fonts/fontawesome-webfont.woff',
'www/vendor/dist/fonts/fontawesome-webfont.woff2',
'www/vendor/dist/fonts/fredoka-one.eot',
'www/vendor/dist/fonts/fredoka-one.woff',
'www/vendor/dist/fonts/glyphicons-halflings-regular.eot',
'www/vendor/dist/fonts/glyphicons-halflings-regular.svg',
'www/vendor/dist/fonts/glyphicons-halflings-regular.ttf',
'www/vendor/dist/fonts/glyphicons-halflings-regular.woff',
'www/vendor/dist/fonts/ubuntu.eot',
'www/vendor/dist/fonts/ubuntu.woff',
'www/vendor/dist/fonts/ubuntu-bold.eot',
'www/vendor/dist/fonts/ubuntu-bold.woff',
]),
('/usr/share/pritunl/www/js', [
main_js_path,
'www/vendor/dist/js/require.min.js',
]),
]
patch_files = []
if install_sysvinit:
data_files.append(('/etc/init.d', ['data/init.d.sysvinit/pritunl']))
if install_upstart:
patch_files.append('%s/pritunl.conf' % PATCH_DIR)
data_files.append(('/etc/init', ['%s/pritunl.conf' % PATCH_DIR]))
if not install_sysvinit:
data_files.append(('/etc/init.d', ['data/init.d.upstart/pritunl']))
shutil.copy('data/init/pritunl.conf', '%s/pritunl.conf' % PATCH_DIR)
if install_systemd:
patch_files.append('%s/pritunl.service' % PATCH_DIR)
data_files.append(('/etc/systemd/system',
['%s/pritunl.service' % PATCH_DIR]))
shutil.copy('data/systemd/pritunl.service',
'%s/pritunl.service' % PATCH_DIR)
for file_name in patch_files:
for line in fileinput.input(file_name, inplace=True):
line = line.replace('%PREFIX%', prefix)
print line.rstrip('\n')
packages = ['pritunl']
for dir_name in os.listdir('pritunl'):
if os.path.isdir(os.path.join('pritunl', dir_name)):
packages.append('pritunl.%s' % dir_name)
setup(
name='pritunl',
version=VERSION,
description='Pritunl vpn server',
long_description=open('README.md').read(),
author='Pritunl',
author_email='[email protected]',
url='https://github.com/pritunl/pritunl',
download_url='https://github.com/pritunl/pritunl/archive/%s.tar.gz' % (
VERSION),
keywords='pritunl, vpn server, distributed vpn server, ' +
'enterprise vpn server, open source vpn server, ' +
'virtual private network, virtual networks, openvpn client, ' +
'openvpn server, vpn tutorial',
packages=packages,
license=open('LICENSE').read(),
zip_safe=False,
install_requires=[
'flask>=0.10.1',
'pymongo>=3.0.3',
],
data_files=data_files,
entry_points={
'console_scripts': ['pritunl = pritunl.__main__:main'],
},
platforms=[
'Linux',
],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: End Users/Desktop',
'License :: Other/Proprietary License',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2.7',
'Topic :: System :: Networking',
],
)