Skip to content

Commit

Permalink
use "==" when comparing strings, python <= 2.5 apparently requires
Browse files Browse the repository at this point in the history
tarfile paths to be ascii only. embed an empty '.packager' file in the
packaging tools tarball so the packaging logic is correctly picked up
  • Loading branch information
marshall committed Dec 18, 2010
1 parent 3f1868c commit 09cb2d5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 4 additions & 0 deletions SConscript.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import tarfile
import zipfile
import sys
from glob import glob
from StringIO import StringIO

sdk_dir = path.join(build.dir, 'sdk')
excludes = ['.pdb', '.exp', '.ilk', '.db', '.gitignore','.psd', '.xib'
Expand Down Expand Up @@ -80,6 +81,9 @@ def build_packaging_tools(target, source, env):
print "Packing packaging tools (%s) " % tgz_file_path
tgz_file = tarfile.open(tgz_file_path, 'w:gz')
add_files_to_archive(tgz_file, effess.add_to_tgz)
tgz_file.addfile(tarfile.TarInfo(
'/'.join(['sdk', build.os, build.version, '.packager'])),
StringIO('#'))
tgz_file.close()

# Builder for all module and runtime component zip files
Expand Down
13 changes: 7 additions & 6 deletions sdk/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

class PackagingEnvironment(object):
def __init__(self, target_os, packaging_server=False):
self.components_dir = None
self.version = __init__.get_titanium_version()
self.excludes = ['.pdb', '.exp', '.ilk', '.lib', '.svn',
'.git', '.gitignore', '.cvsignore']
Expand All @@ -27,19 +28,19 @@ def init_packaging_server_dirs(self, script_dir):
self.install_dirs = [p.join(script_dir, '..', '..', '..')]

def init_normal_dirs(self, script_dir):
if (self.target_os is 'linux'):
if (self.target_os == 'linux'):
self.install_dirs = [
p.expanduser('~/.titanium'),
"/opt/titanium",
"/usr/local/lib/titanium",
"/usr/lib/titanium"
]
elif (self.target_os is 'osx'):
elif (self.target_os == 'osx'):
self.install_dirs = [
p.expanduser('~/Library/Application Support/Titanium'),
'/Library/Application Support/Titanium'
]
elif (self.target_os is 'win32'):
elif (self.target_os == 'win32'):
self.install_dirs = [
p.join(os.environ['APPDATA'], 'Titanium'),
# TODO: Is there a better way to determine this directory?
Expand All @@ -61,11 +62,11 @@ def init_normal_dirs(self, script_dir):
self.components_dir = p.join(script_dir, '..')

def create_app(self, path):
if self.target_os is 'linux':
if self.target_os == 'linux':
return linux_app.LinuxApp(self, path)
if self.target_os is 'osx':
if self.target_os == 'osx':
return osx_app.OSXApp(self, path)
if self.target_os is 'win32':
if self.target_os == 'win32':
return win32_app.Win32App(self, path)

def log(self, text):
Expand Down
6 changes: 5 additions & 1 deletion sdk/linux_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ def package(self, package_dir, bundle=False):
longname = self.name + "-" + self.version
def tar_callback(f, tar_file):
print f
tar_file.add(f, longname + "/" + f.replace(self.stage_dir + os.sep, ""))
# tar paths in <= 2.5 must be non unicode
f = f.encode('ascii', 'ignore')
tarname = longname + "/" + f.replace(self.stage_dir + os.sep, "")
tarname = tarname.encode('ascii', 'ignore')
tar_file.add(f, tarname)

effess.make_tgz(self.stage_dir, p.join(package_dir, longname + '.tgz'),
callback=tar_callback)

0 comments on commit 09cb2d5

Please sign in to comment.