update osx installer to work with data/config

This commit is contained in:
j 2016-01-18 12:04:59 +05:30
parent 9d7763e017
commit 9da362ced6
2 changed files with 10 additions and 7 deletions

View file

@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.4</string>
<string>0.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>

View file

@ -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,7 +86,8 @@ 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 &")
@ -94,8 +97,8 @@ class Install(Thread):
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))