migrate config->data

This commit is contained in:
j 2016-01-18 12:06:31 +05:30
parent eb648284a6
commit 118a8e7371
2 changed files with 35 additions and 12 deletions

View file

@ -2,28 +2,48 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>BuildMachineOSBuild</key>
<string>15C50</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>en</string> <string>en</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>Open Media Library</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string></string> <string>AppIcon</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <string>com.openmedialibrary.Open-Media-Library</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string> <string>Open Media Library</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.4</string> <string>0.5</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>7C68</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>15C43</string>
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0720</string>
<key>DTXcodeBuild</key>
<string>7C68</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> <string>10.11</string>
<key>LSUIElement</key> <key>LSUIElement</key>
<true/> <true/>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>

View file

@ -16,6 +16,9 @@ from threading import Thread
PORT = 9841 PORT = 9841
static_dir = os.path.normpath(os.path.abspath(os.path.dirname(__file__))) 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): class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_OPTIONS(self): def do_OPTIONS(self):
@ -61,8 +64,7 @@ class Install(Thread):
def run(self): def run(self):
target = self.target target = self.target
if not os.path.exists(target): makedirs(target)
os.makedirs(target)
os.chdir(target) os.chdir(target)
release = self.get_release() release = self.get_release()
self.status["release"] = release self.status["release"] = release
@ -84,18 +86,19 @@ class Install(Thread):
self.status["step"] = "setup" self.status["step"] = "setup"
os.system("./ctl setup") os.system("./ctl setup")
self.status["progress"] = 1 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) json.dump(release, fd, indent=2)
self.status = {"installation finished. starting...": True} self.status = {"installation finished. starting...": True}
os.system("./ctl start &") os.system("./ctl start &")
time.sleep(1) time.sleep(1)
self.httpd.shutdown() self.httpd.shutdown()
def download(self, url, filename): def download(self, url, filename):
dirname = os.path.dirname(filename) dirname = os.path.dirname(filename)
if dirname and not os.path.exists(dirname): if dirname:
os.makedirs(dirname) makedirs(dirname)
with open(filename, 'w') as f: with open(filename, 'w') as f:
with closing(urllib2.urlopen(url)) as u: with closing(urllib2.urlopen(url)) as u:
size = int(u.headers.get('content-length', 0)) size = int(u.headers.get('content-length', 0))