forked from organicmaps/organicmaps
[python] Improved usage.
This commit is contained in:
parent
2a97d57399
commit
0f280664ad
2 changed files with 16 additions and 8 deletions
|
@ -98,6 +98,14 @@ class Env:
|
|||
symlink_force(self.temp_borders_path,
|
||||
os.path.join(self.draft_path, "borders"))
|
||||
|
||||
self.osm2ft_path = os.path.join(self.out_path, "osm2ft")
|
||||
if os.path.isdir(self.osm2ft_path):
|
||||
for x in os.listdir(self.osm2ft_path):
|
||||
p = os.path.join(self.osm2ft_path, x)
|
||||
if os.path.isfile(p) and x.endswith(".mwm.osm2ft"):
|
||||
shutil.move(p, os.path.join(self.mwm_path, x))
|
||||
self._create_if_not_exist(self.osm2ft_path)
|
||||
|
||||
self.node_storage = settings.NODE_STORAGE
|
||||
self.user_resource_path = settings.USER_RESOURCE_PATH
|
||||
|
||||
|
@ -116,10 +124,6 @@ class Env:
|
|||
self._subprocess_out = None
|
||||
self._subprocess_countries_out = {}
|
||||
|
||||
self.descriptions_path = os.path.join(self.intermediate_path,
|
||||
"descriptions")
|
||||
self._create_if_not_exist(self.descriptions_path)
|
||||
|
||||
_write_version(self.out_path, self.planet_version)
|
||||
|
||||
self._skipped_stages = set(self.skip)
|
||||
|
@ -146,6 +150,12 @@ class Env:
|
|||
def is_accepted_stage(self, stage_name):
|
||||
return stage_name not in self._skipped_stages
|
||||
|
||||
@property
|
||||
def descriptions_path(self):
|
||||
path = os.path.join(self.intermediate_path, "descriptions")
|
||||
self._create_if_not_exist(self.descriptions_path)
|
||||
return path
|
||||
|
||||
@property
|
||||
def localads_path(self):
|
||||
path = os.path.join(self.out_path, f"localads_{self.mwm_version}")
|
||||
|
|
|
@ -306,14 +306,12 @@ def stage_statistics(env):
|
|||
|
||||
@stage
|
||||
def stage_cleanup(env):
|
||||
osm2ft_path = os.path.join(env.out_path, "osm2ft")
|
||||
os.makedirs(osm2ft_path, exist_ok=True)
|
||||
logger.info(f"osm2ft files will be moved from {env.out_path} "
|
||||
f"to {osm2ft_path}.")
|
||||
f"to {env.osm2ft_path}.")
|
||||
for x in os.listdir(env.mwm_path):
|
||||
p = os.path.join(env.mwm_path, x)
|
||||
if os.path.isfile(p) and x.endswith(".mwm.osm2ft"):
|
||||
shutil.move(p, os.path.join(osm2ft_path, x))
|
||||
shutil.move(p, os.path.join(env.osm2ft_path, x))
|
||||
|
||||
logger.info(f"{env.draft_path} will be removed.")
|
||||
shutil.rmtree(env.draft_path)
|
||||
|
|
Loading…
Add table
Reference in a new issue