From 9da362ced6ae72e67111280e59d2c0d56a6b68de Mon Sep 17 00:00:00 2001 From: j Date: Mon, 18 Jan 2016 12:04:59 +0530 Subject: [PATCH] update osx installer to work with data/config --- .../Open Media Library.app/Contents/Info.plist | 2 +- .../Contents/Resources/install.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Darwin/Applications/Open Media Library.app/Contents/Info.plist b/Darwin/Applications/Open Media Library.app/Contents/Info.plist index b48a5c3..068c940 100644 --- a/Darwin/Applications/Open Media Library.app/Contents/Info.plist +++ b/Darwin/Applications/Open Media Library.app/Contents/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.4 + 0.5 CFBundleSignature ???? CFBundleSupportedPlatforms diff --git a/Darwin/Applications/Open Media Library.app/Contents/Resources/install.py b/Darwin/Applications/Open Media Library.app/Contents/Resources/install.py index 0dc329b..32a379d 100755 --- a/Darwin/Applications/Open Media Library.app/Contents/Resources/install.py +++ b/Darwin/Applications/Open Media Library.app/Contents/Resources/install.py @@ -16,6 +16,9 @@ from threading import Thread PORT = 9841 static_dir = os.path.normpath(os.path.abspath(os.path.dirname(__file__))) +def makedirs(dirname): + if not os.path.exists(dirname): + os.makedirs(dirname) class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_OPTIONS(self): @@ -61,8 +64,7 @@ class Install(Thread): def run(self): target = self.target - if not os.path.exists(target): - os.makedirs(target) + makedirs(target) os.chdir(target) release = self.get_release() self.status["release"] = release @@ -84,18 +86,19 @@ class Install(Thread): self.status["step"] = "setup" os.system("./ctl setup") self.status["progress"] = 1 - with open('config/release.json', 'w') as fd: + makedirs('data') + with open('data/release.json', 'w') as fd: json.dump(release, fd, indent=2) self.status = {"installation finished. starting...": True} os.system("./ctl start &") time.sleep(1) self.httpd.shutdown() - + def download(self, url, filename): dirname = os.path.dirname(filename) - if dirname and not os.path.exists(dirname): - os.makedirs(dirname) + if dirname: + makedirs(dirname) with open(filename, 'w') as f: with closing(urllib2.urlopen(url)) as u: size = int(u.headers.get('content-length', 0))