This repository has been archived by the owner on Mar 9, 2020. It is now read-only.
forked from LinkedInAttic/nginx-config-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
79 lines (66 loc) · 2.2 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
import os
import setuptools
import subprocess
import sys
requirements = [
'six>=1.10.0',
]
extras = {}
def get_version():
import incb
return incb.__version__
def readme():
with open('README.md') as f:
return f.read()
class Venv(setuptools.Command):
user_options = [('python=', None, 'Which interpreter to build your venv with')]
def initialize_options(self):
self.python = ''
def finalize_options(self):
"""Abstract method that is required to be overwritten"""
def run(self):
venv_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'venv', 'incb')
print('Creating virtual environment in {path}'.format(path=venv_path))
if '3' in self.python or sys.version_info[0] >= 3:
import venv
venv.main(args=[venv_path])
else:
venv_cmd = ['virtualenv']
if self.python:
venv_cmd.extend(['-p', self.python])
venv_cmd.append(venv_path)
subprocess.check_call(venv_cmd)
print('Linking `activate` to top level of project.\n')
print('To activate, simply run `source activate`.')
try:
os.symlink(
os.path.join(venv_path, 'bin', 'activate'),
os.path.join(os.path.dirname(os.path.abspath(__file__)), 'activate')
)
except OSError:
# symlink already exists
pass
setuptools.setup(
name='incb',
version=get_version(),
description="A python library for generating nginx configs.",
long_description=readme(),
author="Jin Nguyen",
author_email='[email protected]',
url='https://github.com/MyMusicTaste/incb',
packages=setuptools.find_packages('incb'),
package_dir={'': 'incb'},
include_package_data=True,
install_requires=requirements,
extras_require=extras,
license="BSD license",
keywords='incb',
classifiers=[
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'
],
cmdclass={'venv': Venv},
)