Make paths relative to source file in extract_data

This commit is contained in:
Maciej Ziarkowski 2020-01-20 19:43:19 +00:00
parent d0ab1a641a
commit 25e61bb9cf

View File

@ -64,9 +64,11 @@ def make_data_extract(current_time, connection, zip_file_path):
zip_file_path.parent.mkdir(parents=True, exist_ok=True) zip_file_path.parent.mkdir(parents=True, exist_ok=True)
source_dir_path = Path(__file__).parent
try: try:
with zipfile.ZipFile(zip_file_path, mode='w') as newzip: with zipfile.ZipFile(zip_file_path, mode='w') as newzip:
newzip.write('README.txt') newzip.write(source_dir_path / 'README.txt')
newzip.write('/tmp/building_attributes.csv', arcname='building_attributes.csv') newzip.write('/tmp/building_attributes.csv', arcname='building_attributes.csv')
newzip.write('/tmp/building_uprns.csv', arcname='building_uprns.csv') newzip.write('/tmp/building_uprns.csv', arcname='building_uprns.csv')
newzip.write('/tmp/edit_history.csv', arcname='edit_history.csv') newzip.write('/tmp/edit_history.csv', arcname='edit_history.csv')