Example #1
0
def build_windows_pkg():
    print('building brickv NSIS installer')
    root_path = os.getcwd()

    print('removing old build directories')
    build_path = os.path.join(root_path, 'build')
    dist_path = os.path.join(root_path, 'dist')

    if os.path.exists(build_path):
        shutil.rmtree(build_path)

    if os.path.exists(dist_path):
        shutil.rmtree(dist_path)

    print('freezing images')
    freeze_images()

    print('calling build_all_ui.py release')
    system('python build_all_ui.py release')

    print('preparing manifest')
    prepare_manifest(root_path)

    print('calling setup.py py2exe')
    system('python setup.py py2exe')

    print('calling build_plugin_list.py to undo previous release run')
    system('python build_plugin_list.py')

    # FIXME: doesn't work yet
    #if os.path.exists('X:\\sign.bat'):
    #    sign_py2exe('dist\\brickv.exe')

    print('creating NSIS script from template')
    nsis_template_path = os.path.join(root_path, 'build_data', 'windows',
                                      'nsis', 'brickv_installer.nsi.template')
    nsis_path = os.path.join(dist_path, 'nsis', 'brickv_installer.nsi')
    specialize_template(
        nsis_template_path, nsis_path, {
            '<<BRICKV_DOT_VERSION>>': BRICKV_VERSION,
            '<<BRICKV_UNDERSCORE_VERSION>>': BRICKV_VERSION.replace('.', '_')
        })

    print('building NSIS installer')
    system(
        '"C:\\Program Files\\NSIS\\makensis.exe" dist\\nsis\\brickv_installer.nsi'
    )
    installer = 'brickv_windows_{0}.exe'.format(
        BRICKV_VERSION.replace('.', '_'))

    if os.path.exists(installer):
        os.unlink(installer)

    shutil.move(os.path.join(dist_path, 'nsis', installer), root_path)

    if os.path.exists('X:\\sign.bat'):
        system('X:\\sign.bat ' + installer)
Example #2
0
def build_windows_pkg():
    print('building brickv NSIS installer')
    root_path = os.getcwd()

    print('removing old build directories')
    build_path = os.path.join(root_path, 'build')
    dist_path = os.path.join(root_path, 'dist')

    if os.path.exists(build_path):
        shutil.rmtree(build_path)

    if os.path.exists(dist_path):
        shutil.rmtree(dist_path)

    print('freezing images')
    freeze_images()

    print('calling build_all_ui.py release')
    system('python build_all_ui.py release')

    print('preparing manifest')
    prepare_manifest(root_path)

    print('calling setup.py py2exe')
    system('python setup.py py2exe')

    print('calling build_plugin_list.py to undo previous release run')
    system('python build_plugin_list.py')

    # FIXME: doesn't work yet
    #if os.path.exists('X:\\sign.bat'):
    #    sign_py2exe('dist\\brickv.exe')

    print('creating NSIS script from template')
    nsis_template_path = os.path.join(root_path, 'build_data', 'windows', 'nsis', 'brickv_installer.nsi.template')
    nsis_path = os.path.join(dist_path, 'nsis', 'brickv_installer.nsi')
    specialize_template(nsis_template_path, nsis_path,
                        {'<<BRICKV_DOT_VERSION>>': BRICKV_VERSION,
                         '<<BRICKV_UNDERSCORE_VERSION>>': BRICKV_VERSION.replace('.', '_')})

    print('building NSIS installer')
    system('"C:\\Program Files\\NSIS\\makensis.exe" dist\\nsis\\brickv_installer.nsi')
    installer = 'brickv_windows_{0}.exe'.format(BRICKV_VERSION.replace('.', '_'))

    if os.path.exists(installer):
        os.unlink(installer)

    shutil.move(os.path.join(dist_path, 'nsis', installer), root_path)

    if os.path.exists('X:\\sign.bat'):
        system('X:\\sign.bat ' + installer)
Example #3
0
def build_macosx_pkg():
    print('building brickv disk image')
    root_path = os.getcwd()

    print('removing old build directories')
    build_path = os.path.join(root_path, 'build')
    dist_path = os.path.join(root_path, 'dist')

    if os.path.exists(build_path):
        shutil.rmtree(build_path)

    if os.path.exists(dist_path):
        shutil.rmtree(dist_path)

    print('freezing images')
    freeze_images()

    print('calling build_all_ui.py release')
    system('python build_all_ui.py release')

    print('preparing manifest')
    prepare_manifest(root_path)

    print('calling setup.py py2app build')
    system('python setup.py py2app build')

    print('calling build_plugin_list.py to undo previous release run')
    system('python build_plugin_list.py')

    print('copying build data')
    build_data_path = os.path.join(root_path, 'build_data', 'macosx', '*')
    resources_path = os.path.join(dist_path, 'Brickv.app', 'Contents',
                                  'Resources')
    system('cp -R {0} {1}'.format(build_data_path, resources_path))

    print('patching __boot__.py')
    boot_path = os.path.join(resources_path, '__boot__.py')
    boot_prefix = 'import os\nimport sys\nos.environ["RESOURCEPATH"] = os.path.dirname(os.path.realpath(__file__))\n'

    with open(boot_path, 'rb') as f:
        boot = f.read()

    with open(boot_path, 'wb') as f:
        f.write(boot_prefix + boot)

    print('building disk image')
    dmg_name = 'brickv_macos_{0}.dmg'.format(BRICKV_VERSION.replace('.', '_'))

    if os.path.exists(dmg_name):
        os.remove(dmg_name)

    system('hdiutil create -fs HFS+ -volname "Brickv-{0}" -srcfolder dist {1}'.
           format(BRICKV_VERSION, dmg_name))
Example #4
0
def build_macosx_pkg():
    print('building brickv disk image')
    root_path = os.getcwd()

    print('removing old build directories')
    build_path = os.path.join(root_path, 'build')
    dist_path = os.path.join(root_path, 'dist')

    if os.path.exists(build_path):
        shutil.rmtree(build_path)

    if os.path.exists(dist_path):
        shutil.rmtree(dist_path)

    print('freezing images')
    freeze_images()

    print('calling build_all_ui.py release')
    system('python build_all_ui.py release')

    print('preparing manifest')
    prepare_manifest(root_path)

    print('calling setup.py py2app build')
    system('python setup.py py2app build')

    print('calling build_plugin_list.py to undo previous release run')
    system('python build_plugin_list.py')

    print('copying build data')
    build_data_path = os.path.join(root_path, 'build_data', 'macosx', '*')
    resources_path = os.path.join(dist_path, 'Brickv.app', 'Contents', 'Resources')
    system('cp -R {0} {1}'.format(build_data_path, resources_path))

    print('patching __boot__.py')
    boot_path = os.path.join(resources_path, '__boot__.py')
    boot_prefix = 'import os\nimport sys\nos.environ["RESOURCEPATH"] = os.path.dirname(os.path.realpath(__file__))\n'

    with open(boot_path, 'rb') as f:
        boot = f.read()

    with open(boot_path, 'wb') as f:
        f.write(boot_prefix + boot)

    print('building disk image')
    dmg_name = 'brickv_macos_{0}.dmg'.format(BRICKV_VERSION.replace('.', '_'))

    if os.path.exists(dmg_name):
        os.remove(dmg_name)

    system('hdiutil create -fs HFS+ -volname "Brickv-{0}" -srcfolder dist {1}'.format(BRICKV_VERSION, dmg_name))
Example #5
0
def build_macosx_pkg():
    print('building brickv disk image')
    root_path = os.getcwd()

    print('removing old build directories')
    build_path = os.path.join(root_path, 'build')
    dist_path = os.path.join(root_path, 'dist')

    if os.path.exists(build_path):
        shutil.rmtree(build_path)

    if os.path.exists(dist_path):
        shutil.rmtree(dist_path)

    print('freezing images')
    freeze_images()

    print('calling build_all_ui.py release')
    system('python build_all_ui.py release')

    print('preparing manifest')
    prepare_manifest(root_path)

    print('calling setup.py py2app build')
    system('python setup.py py2app build')

    print('calling build_plugin_list.py to undo previous release run')
    system('python build_plugin_list.py')

    print('copying build data')
    build_data_path = os.path.join(root_path, 'build_data', 'macosx', '*')
    resources_path = os.path.join(dist_path, 'Brickv.app', 'Contents',
                                  'Resources')
    system('cp -R {0} {1}'.format(build_data_path, resources_path))

    print('patching __boot__.py')
    boot_path = os.path.join(resources_path, '__boot__.py')
    boot_prefix = 'import os\nimport sys\nos.environ["RESOURCEPATH"] = os.path.dirname(os.path.realpath(__file__))\n'

    with open(boot_path, 'rb') as f:
        boot = f.read()

    with open(boot_path, 'wb') as f:
        f.write(boot_prefix + boot)

    print('signing brickv binary')
    # NOTE: codesign_identity contains "Developer ID Application: ..."
    codesign_command = 'codesign --force --verify --verbose --sign "`cat codesign_identity`" {0}'
    frameworks_path = os.path.join(dist_path, 'Brickv.app', 'Contents',
                                   'Frameworks')
    qtcore_framework = os.path.join(frameworks_path, 'QtCore.framework')
    qtgui_framework = os.path.join(frameworks_path, 'QtGui.framework')
    qtopengl_framework = os.path.join(frameworks_path, 'QtOpenGL.framework')

    os.unlink(os.path.join(qtcore_framework, 'QtCore'))
    shutil.move(os.path.join(qtcore_framework, 'QtCore.prl'),
                os.path.join(qtcore_framework, 'Versions', 'Current'))
    shutil.move(os.path.join(qtcore_framework, 'Contents'),
                os.path.join(qtcore_framework, 'Versions', 'Current'))

    os.unlink(os.path.join(qtgui_framework, 'QtGui'))
    os.unlink(os.path.join(qtgui_framework, 'Resources'))
    shutil.move(os.path.join(qtgui_framework, 'QtGui.prl'),
                os.path.join(qtgui_framework, 'Versions', 'Current'))
    shutil.move(os.path.join(qtgui_framework, 'Contents'),
                os.path.join(qtgui_framework, 'Versions', 'Current'))

    os.unlink(os.path.join(qtopengl_framework, 'QtOpenGL'))
    shutil.move(os.path.join(qtopengl_framework, 'QtOpenGL.prl'),
                os.path.join(qtopengl_framework, 'Versions', 'Current'))
    shutil.move(os.path.join(qtopengl_framework, 'Contents'),
                os.path.join(qtopengl_framework, 'Versions', 'Current'))

    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'Python.framework')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'QtCore.framework')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'QtGui.framework')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'QtOpenGL.framework')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'libbz2.1.0.6.dylib')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'libcrypto.1.0.0.dylib')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'libdbus-1.3.dylib')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'libiconv.2.dylib')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'libintl.8.dylib')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'libncurses.6.dylib')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'libpng16.16.dylib')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'libssl.1.0.0.dylib')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'libtcl8.6.dylib')))
    system(
        codesign_command.format(os.path.join(frameworks_path,
                                             'libtk8.6.dylib')))
    system(
        codesign_command.format(
            os.path.join(frameworks_path, 'libz.1.2.8.dylib')))
    system(
        codesign_command.format(
            os.path.join(dist_path, 'Brickv.app', 'Contents', 'MacOS',
                         'python')))
    system(codesign_command.format(os.path.join(dist_path, 'Brickv.app')))

    print('building disk image')
    dmg_name = 'brickv_macos_{0}.dmg'.format(BRICKV_VERSION.replace('.', '_'))

    if os.path.exists(dmg_name):
        os.remove(dmg_name)

    system('hdiutil create -fs HFS+ -volname "Brickv-{0}" -srcfolder dist {1}'.
           format(BRICKV_VERSION, dmg_name))
Example #6
0
def build_windows_pkg():
    PWD = os.path.dirname(os.path.realpath(__file__))
    BUILD_PATH = os.path.join(PWD, "build")
    DIST_PATH = os.path.join(PWD, "dist")
    if os.path.exists(BUILD_PATH):
        shutil.rmtree(BUILD_PATH)
    if os.path.exists(DIST_PATH):
        shutil.rmtree(DIST_PATH)

    import py2exe
    system("python build_all_ui.py release")

    data_files = []
    for root, dirnames, names in os.walk(os.path.normcase("build_data/windows/")):
        for name in names:
            path = os.path.join(root, name)
            if os.path.isfile(path):
                data_files.append((os.path.join(root.replace(os.path.normcase("build_data/windows/"), "")), [path]))

    freeze_images()

    setup(name = NAME,
          description = DESCRIPTION,
          version = BRICKV_VERSION,
          data_files = data_files,
          options = {
                    "py2exe" : {
                        "dll_excludes" : ["MSVCP90.dll"],
                        "includes" : ["sip",
                                      "PyQt4.QtCore",
                                      "PyQt4.QtGui",
                                      "PyQt4.QtOpenGL",
                                      "OpenGL.GL",
                                      "ctypes.util",
                                      "serial",
                                      "colorsys",
                                      "win32com.client",
                                      "win32con",
                                      "winerror",
                                      "pywintypes",
                                      "win32file",
                                      "win32api"],
                        "excludes" : ["config_linux",
                                      "config_macosx",
                                      "_gtkagg",
                                      "_tkagg",
                                      "Tkconstants",
                                      "Tkinter",
                                      "tcl",
                                      "pydoc",
                                      "email",
                                      "nose",
                                      "inspect",
                                      "ctypes.macholib",
                                      "win32pdh",
                                      "win32ui"]
                        }
                    },
          zipfile = None,
          windows = [{'script' : 'brickv/main.py',
                      'icon_resources' : [(0, os.path.normcase("build_data/windows/brickv-icon.ico"))],
                      'dest_base' : 'brickv'
                     }]
    )

    print('calling build_plugin_list.py')
    system('python build_plugin_list.py')

    # FIXME: doesn't work yet
    #if os.path.exists('X:\\sign.bat'):
    #    sign_py2exe('dist\\brickv.exe')

    # build nsis
    specialize_template('build_data/windows/nsis/brickv_installer.nsi.template',
                        'dist/nsis/brickv_installer.nsi',
                        {'<<BRICKV_DOT_VERSION>>': BRICKV_VERSION,
                         '<<BRICKV_UNDERSCORE_VERSION>>': BRICKV_VERSION.replace('.', '_')})

    system('"C:\\Program Files\\NSIS\\makensis.exe" dist\\nsis\\brickv_installer.nsi')

    dist_nsis_dir = os.path.join(os.getcwd(), 'dist', 'nsis')
    installer = 'brickv_windows_{0}.exe'.format(BRICKV_VERSION.replace('.', '_'))

    if os.path.exists(installer):
        os.unlink(installer)

    shutil.move(os.path.join(dist_nsis_dir, installer), os.getcwd())

    if os.path.exists('X:\\sign.bat'):
        system('X:\\sign.bat ' + installer)
Example #7
0
def build_macosx_pkg():
    print('building brickv disk image')
    root_path = os.getcwd()

    print('removing old build directories')
    build_path = os.path.join(root_path, 'build')
    dist_path = os.path.join(root_path, 'dist')

    if os.path.exists(build_path):
        shutil.rmtree(build_path)

    if os.path.exists(dist_path):
        shutil.rmtree(dist_path)

    print('freezing images')
    freeze_images()

    print('calling build_all_ui.py release')
    system('python build_all_ui.py release')

    print('preparing manifest')
    prepare_manifest(root_path)

    print('calling setup.py py2app build')
    system('python setup.py py2app build')

    print('calling build_plugin_list.py to undo previous release run')
    system('python build_plugin_list.py')

    print('copying build data')
    build_data_path = os.path.join(root_path, 'build_data', 'macosx', '*')
    resources_path = os.path.join(dist_path, 'Brickv.app', 'Contents', 'Resources')
    system('cp -R {0} {1}'.format(build_data_path, resources_path))

    print('patching __boot__.py')
    boot_path = os.path.join(resources_path, '__boot__.py')
    boot_prefix = 'import os\nimport sys\nos.environ["RESOURCEPATH"] = os.path.dirname(os.path.realpath(__file__))\n'

    with open(boot_path, 'rb') as f:
        boot = f.read()

    with open(boot_path, 'wb') as f:
        f.write(boot_prefix + boot)

    print('signing brickv binary')
    # NOTE: codesign_identity contains "Developer ID Application: ..."
    codesign_command = 'codesign --force --verify --verbose --sign "`cat codesign_identity`" {0}'
    frameworks_path = os.path.join(dist_path, 'Brickv.app', 'Contents', 'Frameworks')
    qtcore_framework = os.path.join(frameworks_path, 'QtCore.framework')
    qtgui_framework = os.path.join(frameworks_path, 'QtGui.framework')
    qtopengl_framework = os.path.join(frameworks_path, 'QtOpenGL.framework')

    os.unlink(os.path.join(qtcore_framework, 'QtCore'))
    shutil.move(os.path.join(qtcore_framework, 'QtCore.prl'), os.path.join(qtcore_framework, 'Versions', 'Current'))
    shutil.move(os.path.join(qtcore_framework, 'Contents'), os.path.join(qtcore_framework, 'Versions', 'Current'))

    os.unlink(os.path.join(qtgui_framework, 'QtGui'))
    os.unlink(os.path.join(qtgui_framework, 'Resources'))
    shutil.move(os.path.join(qtgui_framework, 'QtGui.prl'), os.path.join(qtgui_framework, 'Versions', 'Current'))
    shutil.move(os.path.join(qtgui_framework, 'Contents'), os.path.join(qtgui_framework, 'Versions', 'Current'))

    os.unlink(os.path.join(qtopengl_framework, 'QtOpenGL'))
    shutil.move(os.path.join(qtopengl_framework, 'QtOpenGL.prl'), os.path.join(qtopengl_framework, 'Versions', 'Current'))
    shutil.move(os.path.join(qtopengl_framework, 'Contents'), os.path.join(qtopengl_framework, 'Versions', 'Current'))

    system(codesign_command.format(os.path.join(frameworks_path, 'Python.framework')))
    system(codesign_command.format(os.path.join(frameworks_path, 'QtCore.framework')))
    system(codesign_command.format(os.path.join(frameworks_path, 'QtGui.framework')))
    system(codesign_command.format(os.path.join(frameworks_path, 'QtOpenGL.framework')))
    system(codesign_command.format(os.path.join(frameworks_path, 'libbz2.1.0.6.dylib')))
    system(codesign_command.format(os.path.join(frameworks_path, 'libcrypto.1.0.0.dylib')))
    system(codesign_command.format(os.path.join(frameworks_path, 'libdbus-1.3.dylib')))
    system(codesign_command.format(os.path.join(frameworks_path, 'libiconv.2.dylib')))
    system(codesign_command.format(os.path.join(frameworks_path, 'libintl.8.dylib')))
    system(codesign_command.format(os.path.join(frameworks_path, 'libncurses.6.dylib')))
    system(codesign_command.format(os.path.join(frameworks_path, 'libpng16.16.dylib')))
    system(codesign_command.format(os.path.join(frameworks_path, 'libssl.1.0.0.dylib')))
    system(codesign_command.format(os.path.join(frameworks_path, 'libtcl8.6.dylib')))
    system(codesign_command.format(os.path.join(frameworks_path, 'libtk8.6.dylib')))
    system(codesign_command.format(os.path.join(frameworks_path, 'libz.1.2.8.dylib')))
    system(codesign_command.format(os.path.join(dist_path, 'Brickv.app', 'Contents', 'MacOS', 'python')))
    system(codesign_command.format(os.path.join(dist_path, 'Brickv.app')))

    print('building disk image')
    dmg_name = 'brickv_macos_{0}.dmg'.format(BRICKV_VERSION.replace('.', '_'))

    if os.path.exists(dmg_name):
        os.remove(dmg_name)

    system('hdiutil create -fs HFS+ -volname "Brickv-{0}" -srcfolder dist {1}'.format(BRICKV_VERSION, dmg_name))