def make_po_files(): toolsdir = download_i18n_tools() path = os.pathsep.join((toolsdir, os.environ.get('PATH', ''))) with cd(DIGSBY_ROOT): dpy(['mki18n.py', '-m', '-v', '--domain=Digsby', DIGSBY_ROOT], addenv=dict(PATH=path))
def sip(): sip_path_parent, sip_dir = os.path.split(os.path.abspath(sip_path)) # Get SIP needs_build = True with cd(sip_path_parent): if not isdir(sip_dir): inform('Could not find SIP directory at %r, downloading...' % sip_path) git.run(['clone', SIP_GIT_REPO, sip_dir]) if SIP_GIT_BRANCH != 'master': with cd(sip_dir): git.run([ 'checkout', '-b', SIP_GIT_BRANCH, SIP_GIT_REMOTE + '/' + SIP_GIT_BRANCH ]) else: pass # inform('SIP found at %r, updating...' % sip_path) # with cd(sip_dir): # git.run(['pull']) # if not git.sha_changed() and isfile(sip_exe) and isfile(sip_pyd): # inform('skipping SIP build') # needs_build = False # Build SIP if needs_build and 'nosip' not in sys.argv: with cd(sip_path): if not sys.platform.startswith("win"): dpy([ 'configure.py', '-b', 'sipgen', '-d', 'siplib', '-e', 'siplib', '-v', 'siplib' ]) # sip sets CC and CXX directly to cc and c++ rather than pulling the values # from the environment, which we don't want if we're forcing a 32-bit build # by using gcc 4.0. env = os.environ run([ 'make', 'CC=%s' % env['CC'], 'CXX=%s' % env['CXX'], 'LINK=%s' % env['CXX'] ]) else: dpy(['setup.py', 'build']) assert isfile(sip_exe), "setup.py did not create %s" % sip_exe if sys.platform.startswith("win"): from buildutil import copy_different, DEPS_DIR copy_different(sip_pyd, DEPS_DIR) copy_different(sip_pdb, DEPS_DIR)
def build_py2exe(): from buildutil import DEPS_DIR assert isdir(DEPS_DIR) with cd('DigsbyInstaller' + PY2EXE_DIR): # -i means the PYD will sit next to the files in py2exe/py2exe dpy(['setup.py', 'build', 'install', '--install-lib', str(DEPS_DIR)]) print print 'py2exe source and PYDs are in:' print abspath('.') print
def wxpy(rebuild = False, branch="master"): wxpy_path_parent, wxpy_dir = os.path.split(os.path.abspath(wxpy_path)) # must have wx and webkit directories wx_dir = buildDirs.wxWidgetsDir webkit_dir = buildDirs.wxWebKitDir sip_dir = os.path.abspath(sip_path) with cd(wxpy_path_parent): if not isdir(wxpy_dir): inform('Could not find wxpy directory at %r, downloading...' % wxpy_path) git.run(['clone', WXPY_GIT_REPO, wxpy_dir]) if branch != "master": with cd(wxpy_dir): git.run(['checkout', '-b', branch, 'origin/%s' % branch]) # else: # with cd(wxpy_dir): # git.run(['pull']) # wipe out the "wxpy/build" directory if we're rebuilding if rebuild: inform("rebuilding...removing old build directory") with cd(wxpy_dir): if os.path.isdir('build'): shutil.rmtree('build') sip_pyd_loc = pathjoin(sip_dir, 'siplib') sip_exe = 'sip%s.%s' % (DEBUG_POSTFIX, py_ext) assert os.path.isfile(pathjoin(sip_pyd_loc, sip_exe)), \ "could not find %s at %r" % (sip_exe, sip_pyd_loc) pp = os.pathsep.join([sip_dir, sip_pyd_loc]) os.environ['PYTHONPATH'] = pp print 'PYTHONPATH=' + pp with cd(wxpy_dir): dpy(['setup.py', '--wx=%s' % wx_dir, '--webkit=%s' % webkit_dir] + sys.argv[1:]) install_wxpy()
def build_xmlextra(): '''Builds _xmlextra.pyd, a speedups module for pyxmpp.''' libxml2_dir = abspath(libxml2_dirname) iconv_dir = abspath(iconv_dirname) lxml2_libs = pathjoin(libxml2_dir, 'win32', 'bin.msvc') lxml2_inc = pathjoin(libxml2_dir, 'include') with cd(EXTDIR): import os dpy(['build_xmlextra.py', 'clean']) dpy(['build_xmlextra.py', 'build_ext'] + ([distutils_debug] if distutils_debug else []) + [ '-L' + os.pathsep.join(filter(None, [lxml2_libs] + os.environ.get('LIB', '').split(os.pathsep))), '-I' + os.pathsep.join(filter(None, [iconv_dir, lxml2_inc] + os.environ.get('INCLUDE', '').split(os.pathsep))), 'install', '--install-lib', DEPS_DIR])
def wxpy(rebuild=False, branch="master"): wxpy_path_parent, wxpy_dir = os.path.split(os.path.abspath(wxpy_path)) # must have wx and webkit directories wx_dir = buildDirs.wxWidgetsDir webkit_dir = buildDirs.wxWebKitDir sip_dir = os.path.abspath(sip_path) with cd(wxpy_path_parent): if not isdir(wxpy_dir): inform('Could not find wxpy directory at %r, downloading...' % wxpy_path) git.run(['clone', WXPY_GIT_REPO, wxpy_dir]) if branch != "master": with cd(wxpy_dir): git.run(['checkout', '-b', branch, 'origin/%s' % branch]) # else: # with cd(wxpy_dir): # git.run(['pull']) # wipe out the "wxpy/build" directory if we're rebuilding if rebuild: inform("rebuilding...removing old build directory") with cd(wxpy_dir): if os.path.isdir('build'): shutil.rmtree('build') sip_pyd_loc = pathjoin(sip_dir, 'siplib') sip_exe = 'sip%s.%s' % (DEBUG_POSTFIX, py_ext) assert os.path.isfile(pathjoin(sip_pyd_loc, sip_exe)), \ "could not find %s at %r" % (sip_exe, sip_pyd_loc) pp = os.pathsep.join([sip_dir, sip_pyd_loc]) os.environ['PYTHONPATH'] = pp print 'PYTHONPATH=' + pp with cd(wxpy_dir): dpy(['setup.py', '--wx=%s' % wx_dir, '--webkit=%s' % webkit_dir] + sys.argv[1:]) install_wxpy()
def sip(): sip_path_parent, sip_dir = os.path.split(os.path.abspath(sip_path)) # Get SIP needs_build = True with cd(sip_path_parent): if not isdir(sip_dir): inform('Could not find SIP directory at %r, downloading...' % sip_path) git.run(['clone', SIP_GIT_REPO, sip_dir]) if SIP_GIT_BRANCH != 'master': with cd(sip_dir): git.run(['checkout', '-b', SIP_GIT_BRANCH, SIP_GIT_REMOTE + '/' + SIP_GIT_BRANCH]) else: pass # inform('SIP found at %r, updating...' % sip_path) # with cd(sip_dir): # git.run(['pull']) # if not git.sha_changed() and isfile(sip_exe) and isfile(sip_pyd): # inform('skipping SIP build') # needs_build = False # Build SIP if needs_build and 'nosip' not in sys.argv: with cd(sip_path): if not sys.platform.startswith("win"): dpy(['configure.py', '-b', 'sipgen', '-d', 'siplib', '-e', 'siplib', '-v', 'siplib']) # sip sets CC and CXX directly to cc and c++ rather than pulling the values # from the environment, which we don't want if we're forcing a 32-bit build # by using gcc 4.0. env = os.environ run(['make', 'CC=%s' % env['CC'], 'CXX=%s' % env['CXX'], 'LINK=%s' % env['CXX']]) else: dpy(['setup.py', 'build']) assert isfile(sip_exe), "setup.py did not create %s" % sip_exe if sys.platform.startswith("win"): from buildutil import copy_different, DEPS_DIR copy_different(sip_pyd, DEPS_DIR) copy_different(sip_pdb, DEPS_DIR)
def build_lxml(): from compiledeps import libxml2_dirname libxml2_dir = abspath(libxml2_dirname) iconv_dir = abspath(iconv_dirname) lxml2_libs = pathjoin(libxml2_dir, 'win32', 'bin.msvc') if not isdir(lxml2_libs): fatal('could not find libxml2.lib in %s' % lxml2_libs) lxml2_inc = pathjoin(libxml2_dir, 'include') if not isdir(lxml2_inc): fatal('could not find libxml2 includes directory at %s' % lxml2_inc) if not isdir(iconv_dir): fatal('could not find iconv at %s' % iconv_dir) libxslt_dir = abspath(libxslt.dirname) if not isdir(libxslt_dir): fatal('could not find libxslt at %s' % libxslt_dir) libxslt_lib = pathjoin(libxslt_dir, 'win32', 'bin.msvc') zlib_dir = abspath('zlib-1.2.3') from compiledeps import lxml new = not os.path.exists(lxml.dirname) with cd(lxml.get()): if os.name == 'nt' and new: # after pulling a fresh tarball, apply the patch pointed to by lxml_patch. run([ patch_cmd, '--ignore-whitespace', '-p0', '-i', '../%s' % lxml_patch ]) dpy([ 'setup.py', 'build_ext', '-I' + os.pathsep.join( (lxml2_inc, libxslt_dir, pathjoin(iconv_dir, 'include'))), '-L' + os.pathsep.join((libxslt_lib, lxml2_libs, pathjoin(iconv_dir, 'lib'), zlib_dir)) ] + (['--debug'] if DEBUG else []) + ['install', '--install-lib', DEPS_DIR]) build_libxml2
def build(): # find WX directory from build_wx import WXDIR wxdir = abspath(WXDIR) # find WXPY directory, and SIP directory from build_wxpy import wxpy_path, sip_path sipdir, wxpydir = abspath(sip_path), abspath(wxpy_path) assert isdir(wxdir) assert isdir(sipdir) assert isdir(wxpydir) from buildutil import tardep boost = tardep('http://iweb.dl.sourceforge.net/project/boost/boost/1.42.0/', 'boost_1_42_0', '.tar.gz', 40932853) boost.get() # place these directories on the PYTHONPATH os.environ['PYTHONPATH'] = os.pathsep.join([wxpydir, sipdir]) with cd('../../ext'): dpy(['buildbkl.py', '--wx=%s' % wxdir] + sys.argv[1:])
def build_lxml(): from compiledeps import libxml2_dirname libxml2_dir = abspath(libxml2_dirname) iconv_dir = abspath(iconv_dirname) lxml2_libs = pathjoin(libxml2_dir, 'win32', 'bin.msvc') if not isdir(lxml2_libs): fatal('could not find libxml2.lib in %s' % lxml2_libs) lxml2_inc = pathjoin(libxml2_dir, 'include') if not isdir(lxml2_inc): fatal('could not find libxml2 includes directory at %s' % lxml2_inc) if not isdir(iconv_dir): fatal('could not find iconv at %s' % iconv_dir) libxslt_dir = abspath(libxslt.dirname) if not isdir(libxslt_dir): fatal('could not find libxslt at %s' % libxslt_dir) libxslt_lib = pathjoin(libxslt_dir, 'win32', 'bin.msvc') zlib_dir = abspath('zlib-1.2.3') from compiledeps import lxml new = not os.path.exists(lxml.dirname) with cd(lxml.get()): if os.name == 'nt' and new: # after pulling a fresh tarball, apply the patch pointed to by lxml_patch. run([patch_cmd, '--ignore-whitespace', '-p0', '-i', '../%s' % lxml_patch]) dpy(['setup.py', 'build_ext', '-I' + os.pathsep.join((lxml2_inc, libxslt_dir, pathjoin(iconv_dir, 'include'))), '-L' + os.pathsep.join((libxslt_lib, lxml2_libs, pathjoin(iconv_dir, 'lib'), zlib_dir))] + (['--debug'] if DEBUG else []) + ['install', '--install-lib', DEPS_DIR]) build_libxml2
def build_libxml2(): from compiledeps import libxml2_dirname new = not os.path.exists(libxml2_dirname) libxml2_dir = download_libxml2() with cd(libxml2_dir): if os.name == 'nt' and new: # after pulling a fresh tarball, apply the patch pointed to by lxml_patch. print os.getcwd() run([patch_cmd, '--ignore-whitespace', '-p0', '-i', os.path.abspath(os.path.join('..', libxml2_patch))]) inform(banner = 'libiconv') if not isdir(iconv_dirname): # has a .lib compiled statically to msvcrt.dll wget_cached(iconv_zipfile, iconv_zipfile_size, iconv_url) unzip(iconv_zipfile) else: inform('libiconv directory already exists') patch_libxml2_h(libxml2_dir, 'include') iconv = abspath(iconv_dirname) inform(banner = 'libxml2') print 'passing libiconv path to configure.js as %r' % iconv # copy the fixed setup.py.in print 'copying libxml2.setup.py.msvc2008', pathjoin(libxml2_dir, 'python') patched_setup = 'libxml2.setup.py.msvc2008' assert os.path.exists(patched_setup) copy_different(patched_setup, pathjoin(libxml2_dir, 'python', 'setup.py.in')) with cd(libxml2_dir, 'win32'): debug_flag = ['debug=yes'] if DEBUG else [] run(['cscript', 'configure.js', '//E:JavaScript', 'vcmanifest=yes', 'python=yes'] + debug_flag + [ 'include=%s' % pathjoin(iconv, 'include'), 'lib=%s' % pathjoin(iconv, 'lib')]) makefile = 'Makefile.msvc' # customize the Makefile... with open(makefile) as f: lines = [] for line in f: # 1) optimize a bit more than just /O2 line = line.replace('/O2', '/Os /GS- /GL /Zi') line = line.replace('/nologo /VERSION', '/nologo /OPT:REF /OPT:ICF /DEBUG /VERSION') lines.append(line) with open(makefile, 'w') as f: f.write(''.join(lines)) with cd(libxml2_dir, 'win32'): run(['nmake', '-f', makefile] + (['clean'] if CLEAN else [])) # All finished files go to DEPS_DIR: mkdirs(DEPS_DIR) deps = os.path.abspath(DEPS_DIR) inform(banner='libxml2 python bindings') with cd(libxml2_dir, 'python'): # installs libxml2 python files to deps directory' #post commit hook test line, git failed to catch the last one. dpy(['setup.py', 'build_ext'] + (['--debug'] if DEBUG else []) + ['install', '--install-lib', deps]) # but we still need libxml2.dll libxml2_bindir = pathjoin(libxml2_dir, 'win32', 'bin.msvc') copy_different(pathjoin(libxml2_bindir, 'libxml2.dll'), deps) copy_different(pathjoin(libxml2_bindir, 'libxml2.pdb'), deps) # and iconv.dll copy_different(os.path.join(iconv, 'iconv.dll'), deps) # show which Python was used to build the PYD dpy(['-c', "import sys; print 'libxml2 python bindings built with %s' % sys.executable"]) with cd(DEPS_DIR): dpy(['-c', "import libxml2"]) # build and install libxslt libxslt_dir = build_libxslt() copy_different(os.path.join(libxslt_dir, 'win32', 'bin.msvc', 'libxslt.dll'), deps) copy_different(os.path.join(libxslt_dir, 'win32', 'bin.msvc', 'libexslt.dll'), deps)
def test(): sorter_test_file = os.path.join(buddylist_root, 'test/sorter_test.py') dpy([sorter_test_file], platlib = True)
def test(): sorter_test_file = os.path.join(buddylist_root, 'test/sorter_test.py') dpy([sorter_test_file], platlib=True)
def build_all_deps(): check_windows_sdk_version() #run(['python', 'build_python.py', 'all'] + (['--DEBUG'] if DEBUG else [])) #with cd('..'): #dpy(['compiledeps.py', 'm2crypto']) #dpy(['compiledeps.py', 'syck']) #dpy(['build_libxml2.py', 'libxml2']) dpy(['build_wx.py', 'all']) dpy(['build_webkit.py', ('debug' if DEBUG else 'release')]) #requires libxml2, wx #with cd('..'): #dpy(['compiledeps.py', 'pil']) # uses JPEG lib from wx/webkit #dpy(['build_libxml2.py', 'lxml']) #depends on zlib from PIL dpy(['../build_wxpy.py']) #depends on webkit. dpy(['build_speedups.py']) dpy(['build_cgui.py']) #cgui depends on wx, wxpy dpy(['build_blist.py'])
def build_protocols_speedups(): dpy(['-c', protocols_setup, 'clean']) dpy(['-c', protocols_setup, 'build_ext'] + (['--debug'] if DEBUG else []) + ['install', '--install-lib', DEPS_DIR] )
def build_libxml2(): from compiledeps import libxml2_dirname new = not os.path.exists(libxml2_dirname) libxml2_dir = download_libxml2() with cd(libxml2_dir): if os.name == 'nt' and new: # after pulling a fresh tarball, apply the patch pointed to by lxml_patch. print os.getcwd() run([ patch_cmd, '--ignore-whitespace', '-p0', '-i', os.path.abspath(os.path.join('..', libxml2_patch)) ]) inform(banner='libiconv') if not isdir(iconv_dirname): # has a .lib compiled statically to msvcrt.dll wget_cached(iconv_zipfile, iconv_zipfile_size, iconv_url) unzip(iconv_zipfile) else: inform('libiconv directory already exists') patch_libxml2_h(libxml2_dir, 'include') iconv = abspath(iconv_dirname) inform(banner='libxml2') print 'passing libiconv path to configure.js as %r' % iconv # copy the fixed setup.py.in print 'copying libxml2.setup.py.msvc2008', pathjoin(libxml2_dir, 'python') patched_setup = 'libxml2.setup.py.msvc2008' assert os.path.exists(patched_setup) copy_different(patched_setup, pathjoin(libxml2_dir, 'python', 'setup.py.in')) with cd(libxml2_dir, 'win32'): debug_flag = ['debug=yes'] if DEBUG else [] run([ 'cscript', 'configure.js', '//E:JavaScript', 'vcmanifest=yes', 'python=yes' ] + debug_flag + [ 'include=%s' % pathjoin(iconv, 'include'), 'lib=%s' % pathjoin(iconv, 'lib') ]) makefile = 'Makefile.msvc' # customize the Makefile... with open(makefile) as f: lines = [] for line in f: # 1) optimize a bit more than just /O2 line = line.replace('/O2', '/Os /GS- /GL /Zi') line = line.replace( '/nologo /VERSION', '/nologo /OPT:REF /OPT:ICF /DEBUG /VERSION') lines.append(line) with open(makefile, 'w') as f: f.write(''.join(lines)) with cd(libxml2_dir, 'win32'): run(['nmake', '-f', makefile] + (['clean'] if CLEAN else [])) # All finished files go to DEPS_DIR: mkdirs(DEPS_DIR) deps = os.path.abspath(DEPS_DIR) inform(banner='libxml2 python bindings') with cd(libxml2_dir, 'python'): # installs libxml2 python files to deps directory' #post commit hook test line, git failed to catch the last one. dpy(['setup.py', 'build_ext'] + (['--debug'] if DEBUG else []) + ['install', '--install-lib', deps]) # but we still need libxml2.dll libxml2_bindir = pathjoin(libxml2_dir, 'win32', 'bin.msvc') copy_different(pathjoin(libxml2_bindir, 'libxml2.dll'), deps) copy_different(pathjoin(libxml2_bindir, 'libxml2.pdb'), deps) # and iconv.dll copy_different(os.path.join(iconv, 'iconv.dll'), deps) # show which Python was used to build the PYD dpy([ '-c', "import sys; print 'libxml2 python bindings built with %s' % sys.executable" ]) with cd(DEPS_DIR): dpy(['-c', "import libxml2"]) # build and install libxslt libxslt_dir = build_libxslt() copy_different( os.path.join(libxslt_dir, 'win32', 'bin.msvc', 'libxslt.dll'), deps) copy_different( os.path.join(libxslt_dir, 'win32', 'bin.msvc', 'libexslt.dll'), deps)