Example #1
0
#!/usr/bin/env python
import sys
import os

# Pick the remaining packages from the common directory
sys.path.append('../common/python-lib')
from distribution_tools.copy import mkdirs, copy_file, copy_files, copy_tree
from distribution_tools.download import download
from distribution_tools.archive import extract
from distribution_tools import command

BUILD               = 'build'
PYTHON_BUILD        = os.path.abspath(os.path.join(BUILD, 'python'))

PYSERIAL            = 'pyserial-2.5-rc2'
PYSERIAL_TAR_GZ     = PYSERIAL + '.tar.gz'

# Download and extract pyserial
download(os.path.join(BUILD, PYSERIAL_TAR_GZ),
        'http://prdownloads.sourceforge.net/pyserial/%s' % PYSERIAL_TAR_GZ)
extract(os.path.join(BUILD, PYSERIAL_TAR_GZ), BUILD)

command.execute(['python', 'setup.py', 'install', '--prefix=%s' % (PYTHON_BUILD,)],
        cwd=os.path.join(BUILD, PYSERIAL))
#!/usr/bin/env python
import sys
import os

# Pick the remaining packages from the common directory
sys.path.append('../common/python-lib')
from distribution_tools.copy import mkdirs, copy_file, copy_files, copy_tree
from distribution_tools.download import download
from distribution_tools.archive import extract
from distribution_tools import command

BUILD = 'build'
PYTHON_BUILD = os.path.abspath(os.path.join(BUILD, 'python'))

PYSERIAL = 'pyserial-2.5-rc2'
PYSERIAL_TAR_GZ = PYSERIAL + '.tar.gz'

# Download and extract pyserial
download(os.path.join(BUILD, PYSERIAL_TAR_GZ),
         'http://prdownloads.sourceforge.net/pyserial/%s' % PYSERIAL_TAR_GZ)
extract(os.path.join(BUILD, PYSERIAL_TAR_GZ), BUILD)

command.execute(
    ['python', 'setup.py', 'install',
     '--prefix=%s' % (PYTHON_BUILD, )],
    cwd=os.path.join(BUILD, PYSERIAL))
build_date  = datetime.datetime.utcnow()
version     = build_date.strftime('%Y%m%d.%H%M')
svnversion  = command.capture(['svnversion', '-nc', '../../'])
shortversion= 'Development version: %s (%s)' % (version, svnversion)

create_zip = not os.path.exists(APP_DIR)

# Make the top level directories, in case they don't exist
mkdirs(OUTPUT)
mkdirs(BUILD)
mkdirs(BIN_DIR)
mkdirs(ARDUINO_TVM_CONF_DIR)
mkdirs(ARDUINO_TVM_FW_DIR)

# Download and extract sparkle
download(os.path.join(BUILD, SPARKLE_ZIP),
        'http://sparkle.andymatuschak.org/files/%s' % (urllib.quote(SPARKLE_ZIP) ))
extract(os.path.join(BUILD, SPARKLE_ZIP), BUILD)

# Copy the .app skeleton
# FIXME: There are some .in files in here that need transforming!!!
copy_tree('skel/Transterpreter.app', 
          APP_DIR, 
          substitute=dict(version=version,
                          shortversion=shortversion,
                          sparkle_feed=SPARKLE_FEED))
# Copy the Java application stub
copy_file(
        os.path.join(SYSTEM_FRAMEWORK_DIR, 
            'JavaVM.framework/Resources/MacOS/JavaApplicationStub'),
        os.path.join(APP_DIR, 'Contents/MacOS/'))