forked from AlertaDengue/PySUS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
108 lines (95 loc) · 4.15 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
import setuptools
import glob, os
import atexit
import shutil
from setuptools import setup, find_packages
from setuptools.command.install import install
ld = """
PySUS
=====
This package collects a set of utilities for handling with public databases published by Brazil's DATASUS
The documentation of how to use PySUS can be found here: http://pysus.readthedocs.io/en/latest/
Features
--------
- Decode encoded patient age to any time unit (years, months, etc)
- Convert `.dbc` files to DBF databases or read them into pandas dataframes. DBC files are basically DBFs compressed by a proprietary algorithm.
- Loads SINAN DBC files into Pandas Dataframes
- Downloads SIA, SIH, SIM, SINASC, and ESUS (covid data)
- Geocodes SINAN notified cases in batch. You can use your Google API KEY to avoid Google's free limits.
Installation
------------
Make sure your system has libffi-dev package installed::
$ sudo pip install PySUS
"""
# class PostInstall(install):
# def run(self):
# def _post_install():
# setuptools_path = setuptools.__path__[0].replace('/setuptools', '')
# pysus_path = setuptools.__path__[0].replace('setuptools', 'pysus')
#
# ## This code is to make sure the compiled extension module inside the
# # utilities module is named _readdbc.so
# if os.path.exists(pysus_path):
# comp_mod_list = glob.glob(os.path.join(pysus_path, 'utilities', '_readdbc*.so'))
# for mod in comp_mod_list:
# mod = os.path.split(mod)[-1]
# if mod != '_readdbc.so':
# print(f'Renaming {mod} to _readdbc.so')
# os.chdir(os.path.join(pysus_path, 'utilities'))
# os.rename(mod, '_readdbc.so')
# # Sometimes the compiled module is thrown on the (site|dist)-packages directory
# try:
# shutil.copy(os.path.join(setuptools_path, '_readdbc.abi3.so'),
# os.path.join(setuptools_path, 'pysus', 'utilities', '_readdbc.abi3.so')
# )
# print(f'Copied _readdbc.abi3.so to pysus/utilities')
# except:
# pass
# atexit.register(_post_install)
# install.run(self)
#
# def _post_install():
# setuptools_path = setuptools.__path__[0].replace('/setuptools', '')
# pysus_path = setuptools.__path__[0].replace('setuptools', 'pysus')
#
# ## This code is to make sure the compiled extension module inside the
# # utilities module is named _readdbc.so
# if os.path.exists(pysus_path):
# comp_mod_list = glob.glob(os.path.join(pysus_path, 'utilities', '_readdbc*.so'))
# for mod in comp_mod_list:
# mod = os.path.split(mod)[-1]
# if mod != '_readdbc.so':
# print(f'Renaming {mod} to _readdbc.so')
# os.chdir(os.path.join(pysus_path, 'utilities'))
# os.rename(mod, '_readdbc.so')
# # Sometimes the compiled module is thrown on the (site|dist)-packages directory
# try:
# shutil.copy(os.path.join(setuptools_path, '_readdbc.abi3.so'),
# os.path.join(setuptools_path, 'pysus', 'utilities', '_readdbc.abi3.so')
# )
# print(f'Copied _readdbc.abi3.so to pysus/utilities')
# except:
# pass
# atexit.register(_post_install)
with open('requirements.txt') as f:
requirements = f.readlines()
setup(
name='PySUS',
version='0.5.10',
packages=find_packages(),
package_data={
'': ['*.c', '*.h', '*.o', '*.so', '*.md', '*.txt']
},
include_package_data=True,
zip_safe=False,
url='https://github.com/fccoelho/PySUS',
license='gpl-v3',
author='Flavio Codeco Coelho',
author_email='[email protected]',
description="Tools for dealing with Brazil's Public health data",
long_description=ld,
setup_requires=['cffi>=1.0.0', 'setuptools>26.0.0'],
cffi_modules=["pysus/utilities/_build_readdbc.py:ffibuilder"],
install_requires=requirements,#['pandas', 'dbfread', 'cffi>=1.0.0', 'geocoder', 'requests', 'fastparquet'],
# cmdclass={'install': PostInstall},
)