[python][generator] Fixed stage_localads.

This commit is contained in:
Maksim Andrianov 2019-06-20 02:53:17 +03:00 committed by gmoryes
parent 1f4312f4c4
commit a37850e654
2 changed files with 5 additions and 9 deletions

View file

@ -4,6 +4,7 @@ import logging
import multiprocessing
import os
import shutil
import tarfile
from collections import defaultdict
from functools import partial
from multiprocessing.pool import ThreadPool
@ -26,7 +27,7 @@ from .generator.env import (planet_lock_file, build_lock_file,
from .generator.exceptions import ContinueError, BadExitStatusError
from .generator.gen_tool import run_gen_tool
from .generator.statistics import make_stats, get_stages_info
from .utils.file import is_verified, download_file, make_tarfile
from .utils.file import is_verified, download_file
logger = logging.getLogger("maps_generator")
@ -279,8 +280,9 @@ def stage_external_resources(env):
def stage_localads(env):
create_csv(env.localads_path, env.mwm_path, env.mwm_path, env.types_path,
env.mwm_version, multiprocessing.cpu_count())
make_tarfile(f"{env.localads_path}.tar.gz", env.localads_path)
with tarfile.open(f"{env.localads_path}.tar.gz", "w:gz") as tar:
for filename in os.listdir(env.localads_path):
tar.add(os.path.join(env.localads_path, filename), arcname=filename)
@stage
def stage_statistics(env):

View file

@ -4,7 +4,6 @@ import glob
import logging
import os
import shutil
import tarfile
import urllib.request
from .md5 import md5, check_md5
@ -59,8 +58,3 @@ def symlink_force(target, link_name):
os.symlink(target, link_name)
else:
raise e
def make_tarfile(output_filename, source_dir):
with tarfile.open(output_filename, "w:gz") as tar:
tar.add(source_dir, arcname=os.path.basename(source_dir))