-
Notifications
You must be signed in to change notification settings - Fork 11
/
setup.py
127 lines (110 loc) · 4.25 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
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2014 Starter Kit Development Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################
import os
import stat
from codecs import open
from distutils.core import setup
from shutil import copyfile
from setuptools import find_packages, setup
from setuptools.command.install import install
try: # for pip >= 10
from pip._internal.req import parse_requirements
try:
from pip._internal.download import PipSession
pip_session = PipSession()
except ImportError: # for pip >= 20
from pip._internal.network.session import PipSession
pip_session = PipSession()
except ImportError: # for pip <= 9.0.3
try:
from pip.req import parse_requirements
from pip.download import PipSession
pip_session = PipSession()
except ImportError: # backup in case of further pip changes
pip_session = 'hack'
# Parse requirements.txt to get the list of dependencies
inst_req = parse_requirements('requirements.txt',
session=pip_session)
REQUIREMENTS = [str(r.req) for r in inst_req]
class PostInstallCommand(install):
def run(self):
install.run(self)
print "Run post-installation"
self.set_etc()
def set_etc(self):
dirs = ['/etc/starterkit/templates',
'/etc/starterkit/media']
for d in dirs:
if not os.path.exists(d):
os.makedirs(d)
ls_fname = '/etc/starterkit/local_settings.py'
if not os.path.isfile(ls_fname):
sample_name = os.path.join(
self.install_lib, 'geosk', 'local_settings.py.sample')
copyfile(sample_name, ls_fname)
files = [ls_fname,
'/etc/starterkit/pycsw_settings.py']
for f in files:
open(f, 'a').close()
# make links
link_name = os.path.join(
self.install_lib, 'geosk', os.path.basename(f))
if not os.path.islink(link_name):
print 'make link', link_name
os.symlink(f, link_name)
os.chmod('/etc/starterkit/pycsw_settings.py', stat.S_IREAD | stat.S_IRGRP | stat.S_IROTH |
stat.S_IWRITE | stat.S_IWGRP | stat.S_IWOTH)
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(
name='starterkit',
version=__import__('geosk').get_version(),
description="starterkit, based on GeoNode",
long_description=long_description,
url='https://github.com/SP7-Ritmare/starterkit',
author='Starter Kit Development Team',
author_email='[email protected]',
license="GPL3",
# Full list of classifiers can be found at:
# http://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 2',
],
keywords="StarterKit GeoNode Django sensors SOS",
packages=find_packages(),
install_requires=REQUIREMENTS,
dependency_links=[
"git+https://github.com/SP7-Ritmare/[email protected]#egg=geonode"
],
include_package_data=True,
setup_requires=["setuptools_git >= 0.3", ],
scripts=['bin/sk',
'bin/sk-updateip',
'bin/softInspector.sh',
],
cmdclass={
'install': PostInstallCommand,
},
)