forked from hitranonline/hapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
51 lines (37 loc) · 1.14 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
# -*- coding: utf-8 -*-
#from distutils.core import setup
from setuptools import setup
from hapi.hapi import HAPI_VERSION, HAPI_HISTORY
import re
import sys
import shutil
# Update the README file
shutil.copy('README.md','README.bak')
with open('README.md') as f:
README = f.read()
main_body = re.search('(## Introduction.+)$',README,re.MULTILINE|re.DOTALL).groups(0)[0].rstrip()
HISTORY_LIST = ''
for i,item in enumerate(HAPI_HISTORY):
HISTORY_LIST += ' %d) %s\n'%(i+1,item)
README = """
# HITRAN Application Programming Interface (HAPI)
===============================================
Current version: {hapi_version}
## Version history
{history}
{body}
""".format(hapi_version=HAPI_VERSION,body=main_body,history=HISTORY_LIST.rstrip())
# Python 2 and 3 encoding support
if sys.version_info[0]<3:
with open('README.md','w') as f:
f.write(README.lstrip())
else:
with open('README.md','wb') as f:
f.write(README.lstrip().encode('utf-8'))
# Install the package
setup(
name='hitran-api',
version=HAPI_VERSION,
packages=['hapi',],
license='MIT',
)