This repository was archived by the owner on Jul 25, 2018. It is now read-only.
forked from astronomyk/SimMETIS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·79 lines (61 loc) · 2.15 KB
/
setup.py
File metadata and controls
executable file
·79 lines (61 loc) · 2.15 KB
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
#!/usr/bin/env python3
"""
SimMETIS: A python package to simulate METIS, based on SimCADO
"""
## BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
## update it when the contents of directories change.
#import os
#if os.path.exists('MANIFEST'):
# os.remove('MANIFEST')
# setuptools to allow 'python setup.py develop'. Not necessary for user.
try:
from setuptools import setup
except ImportError:
pass
from datetime import datetime
def get_old_version(filename='simcado/version.py'):
'''Get previous version for auto-update'''
with open(filename, "r") as f:
for i in range(3):
vers = f.readline()
print(vers)
vers = vers.replace("dev", "").replace("'","").split(".")[-1]
return int(float(vers))
# Is this the version number scheme that we want?
MAJOR = 0
MINOR = 4
ATTR = 'dev-METIS'
VERSION = '%d.%d%s' % (MAJOR, MINOR, ATTR)
## This updates TINY every time setup.py is run - doesn't work if
## used by more than one user
#TINY = get_old_version() + 1
#VERSION = '%d.%d.%d%s' % (MAJOR, MINOR, TINY, ATTR)
## Is this needed?
def write_version_py(filename='simcado/version.py'):
cnt = """
# THIS FILE GENERATED BY SIMCADO SETUP.PY
version = '{}'
date = '{}'
"""
timestamp = datetime.utcnow().strftime('%Y-%m-%d %T GMT')
with open(filename, 'w') as fd:
fd.write(cnt.format(VERSION, timestamp))
from distutils.core import setup
def setup_package():
# Rewrite the version file every time
write_version_py()
setup(name = 'SimCADO',
version = VERSION,
description = "MICADO Instrument simulator",
author = "Kieran Leschinski, Oliver Czoske",
author_email = """kieran.leschinski@unive.ac.at,
oliver.czoske@univie.ac.at""",
url = "http://homepage.univie.ac.at/kieran.leschinski/",
package_dir={'simcado': 'simcado'},
packages=['simcado', 'simcado.tests', 'simcado.sandbox'],
# for some reason include_package_data can be temperamental
#include_package_data=True,
package_data = {'simcado': ['data/*']},
)
if __name__ == '__main__':
setup_package()