Fixed some issues with support for nwjs 0.12.0

This commit is contained in:
Joey Payne 2015-03-15 21:27:36 -10:00
commit c20d3cf3b8
141 changed files with 75 additions and 506 deletions

View file

@ -99,16 +99,21 @@ class Setting(object):
else:
self.save_path = self.save_path or DEFAULT_DOWNLOAD_PATH
versions = re.findall('(\d+)\.(\d+)\.(\d+)', version)[0]
minor = int(versions[1])
if minor >= 12:
self.save_path = self.save_path.replace('node-webkit', 'nwjs')
self.get_file_information_from_url()
if self.full_file_path:
return self.full_file_path.format(version)
path = self.full_file_path.format(version)
versions = re.findall('(\d+)\.(\d+)\.(\d+)', version)[0]
minor = int(versions[1])
if minor >= 12:
path = path.replace('node-webkit', 'nwjs')
return path
return ''
def extract_file_path(self, version):
@ -120,6 +125,39 @@ class Setting(object):
for undefined_key, undefined_value in kwargs.items():
setattr(self, undefined_key, undefined_value)
def extract(self, ex_path, version):
if os.path.exists(ex_path):
shutil.rmtree(ex_path)
path = self.save_file_path(version)
file = self.extract_class(path,
*self.extract_args)
# currently, python's extracting mechanism for zipfile doesn't
# copy file permissions, resulting in a binary that
# that doesn't work. Copied from a patch here:
# http://bugs.python.org/file34873/issue15795_cleaned.patch
if path.endswith('.zip'):
members = file.namelist()
for zipinfo in members:
minfo = file.getinfo(zipinfo)
target = file.extract(zipinfo, ex_path)
mode = minfo.external_attr >> 16 & 0x1FF
os.chmod(target, mode)
else:
file.extractall(ex_path)
if path.endswith('.tar.gz'):
dir_name = os.path.join(ex_path, os.path.basename(path).replace('.tar.gz',''))
else:
dir_name = os.path.join(ex_path, os.path.basename(path).replace('.zip',''))
if os.path.exists(dir_name):
for p in os.listdir(dir_name):
abs_file = os.path.join(dir_name, p)
shutil.move(abs_file, ex_path)
shutil.rmtree(dir_name)
def get_file_bytes(self, version):
fbytes = []
@ -278,6 +316,7 @@ class CommandBase(object):
versions = sorted(list(old_versions.union(new_versions)),
key=LooseVersion, reverse=True)
nw_version.values = versions
f = None
try:
@ -298,6 +337,13 @@ class CommandBase(object):
setting = self.files_to_download.pop()
location = self.get_setting('download_dir').value
version = self.selected_version()
path = setting.url.format(version, version)
versions = re.findall('(\d+)\.(\d+)\.(\d+)', version)[0]
minor = int(versions[1])
if minor >= 12:
path = path.replace('node-webkit', 'nwjs')
try:
return self.download_file(setting.url.format(version, version),
setting)
@ -441,14 +487,15 @@ class CommandBase(object):
try:
if setting.value:
extract_path = os.path.join('files', setting.name)
setting.extract(extract_path, version)
if os.path.exists(save_file_path):
setting_fbytes = setting.get_file_bytes(version)
for dest_file, fbytes in setting_fbytes:
path = os.path.join(extract_path, dest_file)
with open(path, 'wb+') as d:
d.write(fbytes)
self.progress_text += '.'
#if os.path.exists(save_file_path):
# setting_fbytes = setting.get_file_bytes(version)
# for dest_file, fbytes in setting_fbytes:
# path = os.path.join(extract_path, dest_file)
# with open(path, 'wb+') as d:
# d.write(fbytes)
# self.progress_text += '.'
self.progress_text += '.'
@ -520,6 +567,11 @@ class CommandBase(object):
name = ex_setting.display_name
self.progress_text = 'Making files for {}...'.format(name)
export_dest = os.path.join(output_dir, ex_setting.name)
versions = re.findall('(\d+)\.(\d+)\.(\d+)', self.selected_version())[0]
minor = int(versions[1])
if minor >= 12:
export_dest = export_dest.replace('node-webkit', 'nwjs')
if os.path.exists(export_dest):
shutil.rmtree(export_dest)
@ -528,14 +580,21 @@ class CommandBase(object):
shutil.copytree(os.path.join('files', ex_setting.name),
export_dest,
ignore=shutil.ignore_patterns('place_holder.txt'))
shutil.rmtree(os.path.join('files', ex_setting.name))
self.progress_text += '.'
if 'mac' in ex_setting.name:
app_path = os.path.join(export_dest,
self.project_name()+'.app')
shutil.move(os.path.join(export_dest,
'node-webkit.app'),
app_path)
try:
shutil.move(os.path.join(export_dest,
'nwjs.app'),
app_path)
except IOError:
shutil.move(os.path.join(export_dest,
'node-webkit.app'),
app_path)
self.progress_text += '.'

View file

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>12F45</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>node-webkit Helper EH</string>
<key>CFBundleExecutable</key>
<string>node-webkit Helper EH</string>
<key>CFBundleIdentifier</key>
<string>com.intel.nw.helper.EH</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>node-webkit Helper EH</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>35.0.1916.157</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1916.157</string>
<key>DTSDKBuild</key>
<string>12F37</string>
<key>DTSDKName</key>
<string>macosx10.8</string>
<key>DTXcode</key>
<string>0511</string>
<key>DTXcodeBuild</key>
<string>5B1008</string>
<key>LSFileQuarantineEnabled</key>
<false/>
<key>LSMinimumSystemVersion</key>
<string>10.6.0</string>
<key>LSUIElement</key>
<string>1</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>SCMRevision</key>
<string>277586</string>
</dict>
</plist>

View file

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>12F45</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>node-webkit Helper NP</string>
<key>CFBundleExecutable</key>
<string>node-webkit Helper NP</string>
<key>CFBundleIdentifier</key>
<string>com.intel.nw.helper.NP</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>node-webkit Helper NP</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>35.0.1916.157</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1916.157</string>
<key>DTSDKBuild</key>
<string>12F37</string>
<key>DTSDKName</key>
<string>macosx10.8</string>
<key>DTXcode</key>
<string>0511</string>
<key>DTXcodeBuild</key>
<string>5B1008</string>
<key>LSFileQuarantineEnabled</key>
<false/>
<key>LSMinimumSystemVersion</key>
<string>10.6.0</string>
<key>LSUIElement</key>
<string>1</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>SCMRevision</key>
<string>277586</string>
</dict>
</plist>

View file

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>12F45</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>node-webkit Helper</string>
<key>CFBundleExecutable</key>
<string>node-webkit Helper</string>
<key>CFBundleIdentifier</key>
<string>com.intel.nw.helper</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>node-webkit Helper</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>35.0.1916.157</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1916.157</string>
<key>DTSDKBuild</key>
<string>12F37</string>
<key>DTSDKName</key>
<string>macosx10.8</string>
<key>DTXcode</key>
<string>0511</string>
<key>DTXcodeBuild</key>
<string>5B1008</string>
<key>LSFileQuarantineEnabled</key>
<false/>
<key>LSMinimumSystemVersion</key>
<string>10.6.0</string>
<key>LSUIElement</key>
<string>1</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>SCMRevision</key>
<string>277586</string>
</dict>
</plist>

View file

@ -1,103 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>12F45</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>node-webkit</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFile</key>
<string>nw.icns</string>
<key>CFBundleTypeName</key>
<string>node-webkit App</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.intel.nw.app</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>None</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>node-webkit</string>
<key>CFBundleIconFile</key>
<string>nw.icns</string>
<key>CFBundleIdentifier</key>
<string>com.intel.nw</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>node-webkit</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>35.0.1916.157</string>
<key>CFBundleVersion</key>
<string>1916.157</string>
<key>DTSDKBuild</key>
<string>12F37</string>
<key>DTSDKName</key>
<string>macosx10.8</string>
<key>DTXcode</key>
<string>0511</string>
<key>DTXcodeBuild</key>
<string>5B1008</string>
<key>LSFileQuarantineEnabled</key>
<false/>
<key>LSMinimumSystemVersion</key>
<string>10.6.0</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>SCMRevision</key>
<string>277586</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.pkware.zip-archive</string>
</array>
<key>UTTypeDescription</key>
<string>node-webkit App</string>
<key>UTTypeIconFile</key>
<string>nw.icns</string>
<key>UTTypeIdentifier</key>
<string>com.intel.nw.app</string>
<key>UTTypeReferenceURL</key>
<string>https://github.com/rogerwang/node-webkit/wiki/How-to-package-and-distribute-your-apps</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>node-webkit</string>
<key>public.filename-extension</key>
<array>
<string>nw</string>
</array>
<key>public.mime-type</key>
<string>application/x-node-webkit-app</string>
</dict>
</dict>
</array>
</dict>
</plist>

View file

@ -1 +0,0 @@
APPL????

Some files were not shown because too many files have changed in this diff Show more