This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
setup.py
59 lines (50 loc) · 1.83 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
from __future__ import print_function
import os
import re
import subprocess
import setuptools
import sys
# If you see the following error, please install 'python-dev'
# error: Setup script exited with error: command 'x86_64-linux-gnu-gcc
# failed with exit status 1"
def check_tools():
with open(os.devnull, 'wb') as dev_null:
for tool in ('unzip', 'make'):
try:
subprocess.check_call([tool], stdout=dev_null, stderr=dev_null)
except subprocess.CalledProcessError:
pass
except OSError:
print("Error! install '{}' before continuing.".format(tool))
return False
return True
def install():
with open('cloudweatherreport/__init__.py', 'rb') as fp:
content = fp.read().decode('utf-8')
version = str(re.search(r'__version__\s+=\s+\'(.*)\'', content).group(1))
current_dir = os.path.abspath(os.path.dirname(__file__))
req_path = os.path.join(current_dir, 'requirements.txt')
with open(req_path) as fp:
reqs = fp.read().splitlines()
setuptools.setup(
name='cloud-weather-report',
author='Juju Developers',
author_email='[email protected]',
version=version, # Update version in cloudweatherreport/__init__.py
license='Affero GNU Public License v3',
description='Assess Juju charms and benchmarks on the clouds.',
url='https://github.com/juju-solutions/cloud-weather-report',
zip_safe=False,
packages=setuptools.find_packages(),
include_package_data=True,
entry_points={
'console_scripts': [
'cwr = cloudweatherreport.run:entry_point',
]
},
install_requires=reqs)
if __name__ == '__main__':
status = check_tools()
if not status:
sys.exit(1)
install()