Skip to content

Commit

Permalink
a pull command that actually works
Browse files Browse the repository at this point in the history
  • Loading branch information
llimllib committed Feb 4, 2012
1 parent 548f947 commit 56e516d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
from glob import glob
from shutil import rmtree
from os.path import join, isdir
from collections import defaultdict

#unlike shutils.copytree, will copy files without disturbing anything that was added
from distutils.dir_util import copy_tree

from configure import config
from lib.utils import copy_tree

def clean():
if isdir("build"):
Expand Down Expand Up @@ -64,10 +66,10 @@ def pull():
#copy the project from mapbox to osm-bright
sanitized_name = re.sub("[^\w]", "", config["name"])
output_dir = join(config["path"], sanitized_name)
copy_tree(output_dir, "osm-bright")
copy_tree(output_dir, "osm-bright", ("layers", ".thumb.png"))

#load the project file
project = loads(open(join("osm-bright", "project.mml")))
project = loads(open(join("osm-bright", "project.mml")).read())

#Make sure we reset postgis data in the project file back to its default values
defaultconfig = defaultdict(defaultdict)
Expand Down Expand Up @@ -97,6 +99,9 @@ def pull():
project_template = open(join("build", "osm-bright.%s.mml") % config["importer"], 'w')
project_template.write(dumps(project, sort_keys=True, indent=2))

#now delete project.mml
unlink(join("osm-bright", "project.mml"))

if __name__ == "__main__":
if sys.argv[-1] == "clean":
clean()
Expand Down

0 comments on commit 56e516d

Please sign in to comment.