-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
setup.py
39 lines (33 loc) · 1.07 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
from setuptools import setup, find_packages
import os
import gzip
import shutil
from pathlib import Path
def gzip_postal_data():
# remove the existing file
curdir = Path(__file__).parent
jsonfile = curdir / 'posuto/postaldata.json'
gzfile = curdir / 'posuto/postaldata.json.gz'
if gzfile.is_file() and not jsonfile.is_file():
# this is an install that already has the gzip
return
if gzfile.is_file() and gzfile.stat().st_mtime > jsonfile.stat().st_mtime:
# we're up to date, nothing to do.
return
# zip the non-compressed file
with open(jsonfile, 'rb') as f_in:
with gzip.open(gzfile, 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
setup(
name='posuto',
version='0.1.10',
url='https://github.com/polm/posuto.git',
author="Paul O'Leary McCann",
author_email='[email protected]',
description='Japanese Postal Code Data',
packages=find_packages(),
package_data={'posuto':['postaldata.json.gz']},
install_requires=[],
)
if __name__ == '__main__':
gzip_postal_data()