def create_stylesheet_project(author, name, filename, extension="7z"): version = "v" + config[name + "_version"] dir = name + "-" + version Project(name) \ .depend(build.Execute(lambda context: copy_stylesheets(context, dir)) .depend(github.Release(author, name, version, filename, extension)))
logging.error( "failed to install PyQt5.sip (returncode %s), see %s and %s", proc.returncode, soutpath, serrpath) return False return True if config.get('Appveyor_Build', True): Project("PyQt5") \ .depend(build.Execute(copy_files) .depend(Patch.Copy([os.path.join(qt_inst_path(), "bin", "Qt5Core.dll"), os.path.join(qt_inst_path(), "bin", "Qt5Xml.dll")], doclambda(lambda: os.path.join(python.python["build_path"], "PCbuild", arch), "python path")) .depend( urldownload.URLDownload( config.get('prebuilt_url') + "PyQt5_gpl-prebuilt-{0}.7z" .format(pyqt_version), name="PyQt5-prebuilt", clean=False ) .set_destination("python-{}".format(python_version)) .depend("sip") .depend("Qt5") ) ) ) else: if pyqt_dev: pyqt_source = urldownloadany.URLDownloadAny(( urldownload.URLDownload( "https://www.riverbankcomputing.com/static/Downloads/PyQt5/{0}/PyQt5-{0}.zip" .format(pyqt_version), tree_depth=1), urldownload.URLDownload(
# You should have received a copy of the GNU General Public License # along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. from unibuild import Project from unibuild.modules import cmake, github, build from config import config import os import shutil import fnmatch googletest_version = "1.7.0" def install(context): for root, dirnames, filenames in os.walk( os.path.join(context['build_path'], "build")): for filename in fnmatch.filter(filenames, "*.lib"): shutil.copy(os.path.join(root, filename), os.path.join(config["paths"]["install"], "libs")) return True Project("GTest") \ .depend(build.Execute(install) .depend(cmake.CMake().arguments(["-Dgtest_force_shared_crt=ON", "-DCMAKE_BUILD_TYPE={0}".format(config["build_type"]) ]) .depend(github.Source("google", "googletest", "master"))) )
except OSError: pass shutil.copyfile(os.path.join(*path_segments, "python{}.zip".format(config["python_version"].replace(".", ""))), os.path.join(ip, "pythoncore.zip")) #shutil.copytree(os.path.join(bp, "Lib"), os.path.join(ip, "pythoncore"), ignore=shutil.ignore_patterns("site-packages", '__pycache__')) os.mkdir(os.path.join(ip, "pythoncore")) for f in glob(os.path.join(*path_segments,"*.pyd")): shutil.copy(f, os.path.join(ip, "pythoncore")) return True Project("python_core") \ .depend(build.Execute(python_core_collect) .depend("Python")) if config['transifex_Enable']: from unibuild.projects import translations translationsBuild = Project("translationsBuild").depend("translations") def copy_licenses(context): boost_version = config['boost_version'] boost_tag_version = ".".join([_f for _f in [boost_version, config['boost_version_tag']] if _f]) license_path = os.path.join(config["paths"]["install"], "bin", "licenses") build_path = config["paths"]["build"] try: os.makedirs(license_path) except:
if "NexusClientCli" not in sln.projectsByName: newproj = sln.AddProject('NexusClientCli', ProjectType.CSHARP_PROJECT, ncc_csproj, guid=projguid) log.info('Adding project %s (%s) to NexusClient.sln', newproj.name, newproj.guid) changed = True else: newproj = sln.projectsByName['NexusClientCli'] log.info('Project %s (%s) already exists in NexusClient.sln', newproj.name, newproj.guid) if newproj.projectfile != ncc_csproj: log.info('Changing projectfile: %s -> %s', newproj.projectfile, ncc_csproj) newproj.projectfile = ncc_csproj changed = True if changed: log.info('Writing NexusClientCli.sln') sln.SaveToFile(os.path.relpath(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln'))) # So we dont get conflicts when pulling return True # https://github.com/Nexus-Mods/Nexus-Mod-Manager/commit/03448e0eb02e08f37d7b66507d0537ab67841321 broke fomod installation # until this is fixed we lock NMM to the latest nexus release. Project("ncc") \ .depend(build.Run(r"publish.bat".format("-debug" if config['build_type'] == "Debug" else "-release", os.path.join(config["paths"]["install"], "bin")), working_directory=lazy.Evaluate(lambda: os.path.join(build_path, "NexusClientCli"))) .depend(msbuild.MSBuild(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln'), working_directory=lazy.Evaluate(lambda: os.path.join(build_path, "Nexus-Mod-Manager")), project_platform="Any CPU") .depend(build.Execute(prepare_nmm, name="append NexusClientCli project to NMM") .depend(github.Source("Nexus-Mods", "Nexus-Mod-Manager", "0.63.15", None, False)) .depend(github.Source(config['Main_Author'], "modorganizer-NCC", "master") .set_destination("NexusClientCli")))))
os.path.join(bp, "sip"), "-e", os.path.join(bp, "include") ], env=config["__environment"], cwd=self._context["build_path"], shell=True, stdout=sout, stderr=serr) proc.communicate() if proc.returncode != 0: logging.error( "failed to run sip configure.py (returncode %s), see %s and %s", proc.returncode, soutpath, serrpath) return False return True Project('sip') \ .depend(build.Execute(copy_pyd) .depend(build.Make(environment=sip_environment()).install() .depend(SipConfigure() .depend("Python") .depend(sourceforge.Release("pyqt", "sip/sip-{0}/sip-{0}.zip".format(sip_version), 1) ) ) ) )
from config import config from unibuild import Project from unibuild.modules import build, github, Patch # TODO: transifex version = "v2.1.0" def translations_install(context): try: os.mkdir( os.path.join(config["paths"]["install"], "bin", "translations")) except: pass for file in glob.iglob( os.path.join(config["paths"]["build"], "translations-{}".format(version), "*.qm")): if os.path.isfile(file): shutil.copy2( file, os.path.join(config["paths"]["install"], "bin", "translations")) return True Project("translations") \ .depend(build.Execute(translations_install) .depend(github.Release("LePresidente", "modorganizer", version, "translations", extension="7z", tree_depth=1) .set_destination("translations-{}".format(version))))
os.path.join(get_visual_studio_2017('15.0'), "..", "..", "..", "Common7", "IDE", "devenv.exe"), "PCBuild/pcbuild.sln", "/upgrade" ] def install(context): make_sure_path_exists(os.path.join(path_install, "libs")) path_segments = [context['build_path'], "PCbuild"] if config['architecture'] == "x86_64": path_segments.append("amd64") path_segments.append("*.lib") shutil.copy(os.path.join(python['build_path'], "PC", "pyconfig.h"), os.path.join(python['build_path'], "Include", "pyconfig.h")) for f in glob(os.path.join(*path_segments)): shutil.copy(f, os.path.join(path_install, "libs")) return True def download(context): return True python = Project("Python") \ .depend(build.Execute(install) .depend(msbuild.MSBuild("PCBuild/PCBuild.sln", "python,pyexpat", project_PlatformToolset=config['vc_platformtoolset']) .depend(build.Run(upgrade_args, name="upgrade python project") .depend(github.Source("LePresidente", "cpython-1", config.get('python_version', "2.7"), shallowclone=True) \ .set_destination("python-{}".format(python_version + python_version_minor))))))
proc.communicate() if proc.returncode != 0: logging.error( "failed to run pyqt configure.py (returncode %s), see %s and %s", proc.returncode, soutpath, serrpath) return False return True Project("PyQt5") \ .depend(build.Execute(copy_pyd) .depend(Patch.Copy([os.path.join(qt5.qt_inst_path, "bin", "Qt5Core.dll"), os.path.join(qt5.qt_inst_path, "bin", "Qt5Xml.dll"), os.path.join(config['paths']['build'], "icu" , "dist", "lib", "icudt{}.dll".format(icu_version)), os.path.join(config['paths']['build'], "icu", "dist", "lib", "icuin{}.dll".format(icu_version)), os.path.join(config['paths']['build'], "icu", "dist", "lib", "icuuc{}.dll".format(icu_version))], doclambda(lambda: python.python['build_path'], "python path")) .depend(build.Make(environment=lazy.Evaluate(pyqt5_env)).install() .depend(PyQt5Configure() .depend("sip") .depend("Qt5") .depend(sourceforge.Release("pyqt", "PyQt5/PyQt-{0}.{1}/PyQt5_gpl-{0}.{1}.zip" .format(qt5.qt_version, qt5.qt_version_minor), tree_depth=1)) ) ) ) )
if newproj.projectfile != ncc_csproj: log.info('Changing projectfile: %s -> %s', newproj.projectfile, ncc_csproj) newproj.projectfile = ncc_csproj changed = True if changed: log.info('Writing NexusClientCli.sln') try: sln.SaveToFile(os.path.relpath(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln'))) # So we dont get conflicts when pulling except ValueError: sln.SaveToFile(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln')) return True # https://github.com/Nexus-Mods/Nexus-Mod-Manager/commit/03448e0eb02e08f37d7b66507d0537ab67841321 broke fomod installation # until this is fixed we lock NMM to the latest nexus release. Project("ncc") \ .depend(build.Run(r"publish.bat {} {}".format("-debug" if config['build_type'] == "Debug" else "-release", os.path.join(config["paths"]["install"], "bin")), working_directory=lazy.Evaluate(lambda: os.path.join(build_path, "NexusClientCli"))) .depend(msbuild.MSBuild(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln'), working_directory=lazy.Evaluate(lambda: os.path.join(build_path, "Nexus-Mod-Manager")), project_platform="Any CPU") .depend(build.Run(r"nuget.exe restore {}".format(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln')), environment=ncc_environment(), working_directory=lazy.Evaluate(lambda: os.path.join(build_path, "Nexus-Mod-Manager"))) .depend(build.Execute(prepare_nmm, name="append NexusClientCli project to NMM") .depend(github.Source("Nexus-Mods", "Nexus-Mod-Manager", config["nmm_version"], None, None, False)) .depend(github.Source(config['Main_Author'], "modorganizer-NCC", config['Build_Branch'], feature_branch=config['Feature_Branch']) .set_destination("NexusClientCli")))))) \ .depend("nuget")
def copy_platform(context): make_sure_path_exists(os.path.join(config['paths']['install'], "bin", "platforms")) for f in glob( os.path.join(config["paths"]["build"], "qt5.git", "qtbase", "plugins", "platforms", "qwindows.dll")): shutil.copy(f, os.path.join(config['paths']['install'], "bin", "platforms")) return True qt5 = Project("Qt5") \ .depend(build.Execute(copy_imageformats) .depend(build.Execute(copy_platform) .depend(build.Execute(copy_icu_libs) .depend(install_qt5 .depend(build_qt5 .depend("jom") .depend(build.Run(configure_cmd, name="configure qt", environment=qt5_environment()) .depend(init_repo) .depend("icu") .depend("openssl") ) ) ) ) ) )
depend( urldownload. URLDownload( "https://github.com/ModOrganizer2/modorganizer-umbrella/releases/download/1.1/lz4_prebuilt_{}.7z" .format(lz4_version_minor)).set_destination(lz_path)))) else: Project("lz4").depend( Patch.Copy( os.path.join(lz_path, "bin", "liblz4.pdb"), os.path.join(config["paths"]["install"], "pdb")).depend( Patch.Copy( os.path.join(lz_path, "bin", "liblz4.dll"), os.path.join( config["paths"]["install"], "bin", "dlls")).depend( build.Execute(copy_binaries).depend( msbuild.MSBuild( os.path.join(lz_path, "visual", "VS2017", 'lz4.sln'), project="liblz4-dll", working_directory=lazy.Evaluate( lambda: os.path.join(lz_path)), reltarget="Release").depend( build.Run( upgrade_args, name="upgrade lz4 project").depend( github.Source( "lz4", "lz4", lz4_version_minor). set_destination(lz_path)))))))
init_transifex_repo = build.Run("{} init --force --no-interactive" .format(transifex_client_binary), name="init transifex repository", environment=transifex_environment()) def install_qt_translations(context): full_install_path = os.path.join(install_path, "bin", "translations") qt_qm_path = os.path.join(config["paths"]["qt_binary_install"], "translations") translated_ts_path = os.path.join(build_path, "transifex-translations", "translations", "mod-organizer.organizer") for ts_file in glob(os.path.join(translated_ts_path, "*.ts")): language_code = os.path.splitext(os.path.basename(ts_file))[0] qt_qm = "qt_" + language_code + ".qm" if os.path.isfile(os.path.join(qt_qm_path, qt_qm)): shutil.copy(os.path.join(qt_qm_path, qt_qm), os.path.join(full_install_path, qt_qm)) qtbase_qm = "qtbase_" + language_code + ".qm" if os.path.isfile(os.path.join(qt_qm_path, qtbase_qm)): shutil.copy(os.path.join(qt_qm_path, qtbase_qm), os.path.join(full_install_path, qtbase_qm)) return True Project("translations") \ .depend(build.Execute(install_qt_translations) .depend(GenerateTranslations() .depend(PullTranslations() .depend(init_transifex_repo .depend(build.Execute(translations_stage) .depend(github.Release("transifex", "transifex-client", transifex_version, "tx.py36.x64", extension="exe") .set_destination("transifex-translations")))))))
environment=config['__Default_environment'], working_directory=os.path.join(os.getcwd())) for dep in dependencies: unimake32.depend(dep) Project(project32 + "_32").depend(unimake32) else: Project(project32 + "_32").dummy().depend(project32) # TODO remove after repo merge def replace_paths(context): with open(os.path.join(build_path, "usvfs", "vsbuild", "external_dependencies.props"), 'r') as file: lines = file.readlines() # keep whitespaces at the beginning for formatting lines[4] = " <BOOST_PATH>..\..\{}</BOOST_PATH>\n".format(boost_folder) lines[5] = " <GTEST_PATH>..\..\{}</GTEST_PATH>\n".format(gtest_folder) file.seek(0) # clean file first or we leave trailing characters behind with open(os.path.join(build_path, "usvfs", "vsbuild", "external_dependencies.props"), 'w') as file: file.writelines(lines) return True usvfs \ .depend(msbuild.MSBuild("usvfs.sln", vs_target, os.path.join(build_path, "usvfs", "vsbuild"), "{}".format("x64" if config['architecture'] == 'x86_64' else "x86")) .depend(build.Execute(replace_paths) .depend("boost" + suffix) .depend("GTest" + suffix) .depend(github.Source(config['Main_Author'], "usvfs", config['Main_Branch']))))
OpenSSL_Install = build.Run( "{} /D /J {} install_engines".format(config["paths"]["jom"], cpus), environment=openssl_environment(), name="Build & Install OpenSSL", working_directory=lambda: os.path.join(openssl_path), retries=5) Configure_openssl = build.Run( r"{} Configure --openssldir={} --prefix={} -FS VC-WIN{}A".format( config['paths']['perl'], os.path.join(openssl_path, "build"), os.path.join(openssl_path, "build"), bitness()), environment=openssl_environment(), name="Configure OpenSSL", working_directory=lambda: os.path.join(openssl_path)) if config['Appveyor_Build']: openssl = Project("openssl") \ .depend(build.Execute(openssl_stage) .depend(urldownload.URLDownload(config.get('prebuilt_url') + "openssl-prebuilt-{}.7z" .format(openssl_version)) .set_destination("openssl-{}".format(openssl_version)))) else: openssl = Project("openssl") \ .depend(build.Execute(openssl_stage) .depend(OpenSSL_Install .depend(Configure_openssl .depend(urldownloadany.URLDownloadAny(( urldownload.URLDownload(url_latest, tree_depth=1), urldownload.URLDownload(url_archive, tree_depth=1))) .depend("nasm")))))
try: return True except OSError: return False boost_prepare = Project("boost_prepare") \ .depend(b2.Bootstrap() \ .depend(Patch.CreateFile(user_config_jam, lambda: config_template.format(python_version, os.path.join(python.python['build_path'], "PCBuild", "{}".format("" if config['architecture'] == 'x86' else "amd64")).replace("\\",'/'), os.path.join(python.python['build_path']).replace("\\", '/'), "64" if config['architecture'] == "x86_64" else "32")) \ .depend(build.Execute(patchboost) .depend(sourceforge.Release("boost", "boost/{0}/boost_{1}.tar.bz2" .format(boost_version, boost_version.replace(".", "_")),tree_depth=1) .set_destination("boost_{}".format(boost_version)))))) if config['architecture'] == 'x86_64': # This is a convient way to make each boost flavors we build have these dependencies: boost_prepare.depend("Python") boost = Project("boost") if config['architecture'] == 'x86_64': boost_stage = Patch.Copy( os.path.join("{}/stage/lib/boost_python-vc{}-mt-{}-{}.dll".format( boost_path, vc_version.replace(".", ""), "x64" if config['architecture'] == "x86_64" else "x86", "_".join(boost_version.split("_")[:-1]))), os.path.join(config["paths"]["install"], "bin"))
qt5 = Project("Qt5") \ .depend(install_webkit .depend(build_webkit .depend(build.Execute(copy_imageformats) .depend(build.Execute(copy_platform) .depend(build.Execute(copy_icu_libs) .depend(install_qt5 .depend(build_qt5 .depend("jom") .depend(build.Run(configure_cmd, name="configure qt", environment=qt5_environment()) .depend(patch .Replace("qtbase/configure.bat", "if not exist %QTSRC%.gitignore goto sconf","") .depend(webkit_patch .depend(init_repo) ) ) .depend("openssl") .depend("icu") ) ) ) ) ) ) ) )
) ) ) ) else: def install(context): path_segments = [context['build_path'], "PCbuild"] if config['architecture'] == "x86_64": path_segments.append("amd64") path_segments.append("*.lib") for f in glob(os.path.join(*path_segments)): shutil.copy( f, os.path.join(config["__build_base_path"], "install", "libs")) return True python = Project("Python") \ .depend(build.Execute(install) .depend(msbuild.MSBuild("PCBuild/PCBuild.sln", "python") .depend(build.Run(upgrade_args, name="upgrade python project") .depend(build.Run(r"PCBuild\get_externals.bat", environment=python_environment()) .depend(urldownload.URLDownload("{0}/{1}/Python-{1}.tgz" .format(python_url, python_version), 1) ) ) ) ) )
def python_zip_collect(context): import libpatterns import glob from zipfile import ZipFile ip = os.path.join(config["paths"]["install"], "bin") bp = python.python['build_path'] with ZipFile(os.path.join(ip, "python27.zip"), "w") as pyzip: for pattern in libpatterns.patterns: for f in glob.iglob(os.path.join(bp, pattern)): pyzip.write(f, f[len(bp):]) return True Project("python_zip") \ .depend(build.Execute(python_zip_collect) .depend("Python") ) if config['Installer']: # build_installer = cmake.CMake().arguments(cmake_parameters +["-DCMAKE_INSTALL_PREFIX:PATH={}/installer".format(config["__build_base_path"])]).install() wixinstaller = Project("WixInstaller") wixinstaller.depend( github.Source(config['Main_Author'], "modorganizer-WixInstaller", "VSDev", super_repository=tl_repo) .set_destination("WixInstaller")) \ .depend("modorganizer").depend("usvfs").depend("usvfs_32")
proc.communicate() if proc.returncode != 0: logging.error("failed to run installer (returncode %s)", proc.returncode) return False libeay_path = os.path.join(context['build_path'], "lib", "VC", "static", libeay) ssleay_path = os.path.join(context['build_path'], "lib", "VC", "static", ssleay) wait_counter = timeout while wait_counter > 0: if os.path.isfile(libeay_path) and os.path.isfile(ssleay_path): break else: time.sleep(1.0) wait_counter -= 1 # wait a bit longer because the installer may have been in the process of writing the file time.sleep(1.0) if wait_counter <= 0: logging.error("Unpacking of OpenSSL timed out") return False #We timed out and nothing was installed return True openssl = Project("openssl")\ .depend(build.Execute(build_func) .depend(urldownload.URLDownload(url)) )
for f in glob(os.path.join(*path_segments, "libffi-*.dll")): shutil.copy(f, os.path.join(path_install, "bin")) shutil.copy( os.path.join(*path_segments, "python{}.pdb".format(python_version.replace(".", ""))), os.path.join(path_install, "pdb")) for f in glob(os.path.join(*path_segments, "_*.pdb")): shutil.copy(f, os.path.join(path_install, "pdb")) return True if config.get('Appveyor_Build', True): python = Project("Python") \ .depend(build.Execute(install) .depend(urldownload.URLDownload( config.get('prebuilt_url') + "python-prebuilt-{}.7z" .format(python_version + python_version_minor)). set_destination("python-{}".format(python_version + python_version_minor)))) else: Project("libffi").depend( github.Source("python", "cpython-bin-deps", "libffi", shallowclone=True).set_destination("libffi")) python = Project("Python") \ .depend(build.Execute(install) .depend(build.Execute(python_prepare) .depend(PydCompiler() .depend(msbuild.MSBuild("PCBuild/PCBuild.sln", "python,pythonw,python3dll,select,pyexpat,unicodedata,_queue,_bz2,_ssl,_overlapped", project_PlatformToolset=config['vc_platformtoolset'],
) ) else: def install(context): make_sure_path_exists(os.path.join(config["paths"]["install"], "libs")) path_segments = [context['build_path'], "PCbuild"] if config['architecture'] == "x86_64": path_segments.append("amd64") path_segments.append("*.lib") shutil.copy( os.path.join(python['build_path'], "PC", "pyconfig.h"), os.path.join(python['build_path'], "Include", "pyconfig.h")) for f in glob(os.path.join(*path_segments)): shutil.copy(f, os.path.join(config["paths"]["install"], "libs")) return True python = Project("Python") \ .depend(build.Execute(install) .depend(msbuild.MSBuild("PCBuild/PCBuild.sln", "python,pyexpat", project_PlatformToolset=python_toolset) # .depend(build.Run(r'PCBuild\\build.bat -e -c Release -m -p {} "/p:PlatformToolset={}"'.format("x64" if config['architecture'] == 'x86_64' else "x86",config['vc_platform']), # environment=python_environment(), # working_directory=lambda: os.path.join(python['build_path'])) .depend(build.Run(upgrade_args, name="upgrade python project") .depend(github.Source("LePresidente", "cpython-1", config.get('python_version', "2.7")) \ .set_destination("python-{}".format(python_version)))) ) )
"--confirm-license", "-b", bp, "-d", os.path.join(bp, "Lib", "site-packages"), "-v", os.path.join(bp, "sip", "PyQt5"), "--sip-incdir", os.path.join(bp, "Include"), "--spec=win32-msvc"], env=pyqt5_env(), cwd=self._context["build_path"], shell=True, stdout=sout, stderr=serr) proc.communicate() if proc.returncode != 0: logging.error("failed to run pyqt configure.py (returncode %s), see %s and %s", proc.returncode, soutpath, serrpath) return False return True Project("PyQt5") \ .depend(build.Execute(copy_pyd) .depend(Patch.Copy([os.path.join(qt_inst_path(), "bin", "Qt5Core.dll"), os.path.join(qt_inst_path(), "bin", "Qt5Xml.dll")], doclambda(lambda: python.python['build_path'], "python path")) .depend(build.Make(environment=lazy.Evaluate(pyqt5_env)).install() .depend(PyQt5Configure() .depend("sip") .depend("Qt5") .depend(sourceforge.Release("pyqt", "PyQt5/PyQt-{0}/PyQt5_gpl-{0}.zip" .format(pyqt_version), tree_depth=1))))))
logging.error( "failed to run pyqt configure.py (returncode %s), see %s and %s", proc.returncode, soutpath, serrpath) return False return True init_transifex_repo = build.Run( "{} init --token={} --force --no-interactive".format( transifex_client_binary, transifex_api), name="init transifex repository") config_transifex_repo = build.Run( "{} config mapping-remote https://www.transifex.com/tannin/mod-organizer/". format(transifex_client_binary), name="config transifex repository") pull_transifex_repo = build.Run("{} pull -a -f --minimum-perc={}".format( transifex_client_binary, transifex_minimum_percentage), name="pull transifex repository") Project("translations") \ .depend(GenerateTranslations() .depend(pull_transifex_repo .depend(config_transifex_repo .depend(init_transifex_repo .depend(build.Execute(translations_stage) .depend(github.Release("transifex", "transifex-client", transifex_version, "tx.py27.x64", extension="exe") .set_destination("transifex-translations")))))))
) ) else: def install(context): make_sure_path_exists( os.path.join(config["__build_base_path"], "install", "libs")) path_segments = [context['build_path'], "PCbuild"] if config['architecture'] == "x86_64": path_segments.append("amd64") path_segments.append("*.lib") shutil.copy( os.path.join(python['build_path'], "PC", "pyconfig.h"), os.path.join(python['build_path'], "Include", "pyconfig.h")) for f in glob(os.path.join(*path_segments)): shutil.copy( f, os.path.join(config["__build_base_path"], "install", "libs")) return True python = Project("Python") \ .depend(build.Execute(install) #.depend(msbuild.MSBuild("PCBuild/PCBuild.sln", "python") .depend(build.Run(r"PCBuild\\build.bat -e -c Release -m -p {}".format("x64" if config['architecture'] == 'x86_64' else ""), environment=python_environment(), working_directory=lambda: os.path.join(python['build_path'])) .depend(build.Run(upgrade_args, name="upgrade python project") .depend(github.Source("LePresidente", "cpython", "2.7").set_destination("Python-2.7.12"))) ) )
import glob from zipfile import ZipFile ip = os.path.join(config["paths"]["install"], "bin") bp = python.python['build_path'] with ZipFile(os.path.join(ip, "python27.zip"), "w") as pyzip: for pattern in libpatterns.patterns: for f in glob.iglob(os.path.join(bp, pattern)): pyzip.write(f, f[len(bp):]) return True Project("python_zip") \ .depend(build.Execute(python_zip_collect) .depend("Python")) if config['Installer']: # build_installer = cmake.CMake().arguments(cmake_parameters # +["-DCMAKE_INSTALL_PREFIX:PATH={}/installer".format(config["__build_base_path"])]).install() wixinstaller = Project("WixInstaller") \ .depend(github.Source(config['Main_Author'], "modorganizer-WixInstaller", "master", super_repository=tl_repo) .set_destination("WixInstaller")) \ .depend("modorganizer").depend("usvfs").depend("usvfs_32") def fix(context): import shutil try: os.makedirs( os.path.join(config["paths"]["install"], "bin", "dlls",
if config['architecture'] == "x86_64": path_segments.append("amd64") for f in glob(os.path.join(*path_segments,"*.lib")): shutil.copy(f, os.path.join(path_install, "libs")) for f in glob(os.path.join(*path_segments,"*.dll")): shutil.copy(f, os.path.join(path_install, "bin")) shutil.copy(os.path.join(path_install, "libs", "python{}.lib".format(python_version.replace(".", ""))), os.path.join(path_install, "libs", "python3.lib")) return True if config.get('Appveyor_Build', True): python = Project("Python") \ .depend(build.Execute(install) .depend(urldownload.URLDownload( config.get('prebuilt_url') + "python-prebuilt-{}.7z" .format(python_version + python_version_minor)). set_destination("python-{}".format(python_version + python_version_minor)))) else: python = Project("Python") \ .depend(build.Execute(install) .depend(build.Execute(python_prepare) .depend(msbuild.MSBuild("PCBuild/PCBuild.sln", "python,pyexpat", project_PlatformToolset=config['vc_platformtoolset']) .depend(build.Run(upgrade_args, name="upgrade python project") .depend(github.Source("python", "cpython", "v{}{}" .format(config['python_version'], config['python_version_minor']) , shallowclone=True) .set_destination("python-{}".format(python_version + python_version_minor)))))))
Project(project32 + "_32").dummy().depend(project32) # TODO remove after repo merge def replace_paths(context): with open( os.path.join(build_path, "usvfs", "vsbuild", "external_dependencies.props"), 'r') as file: lines = file.readlines() # keep whitespaces at the beginning for formatting lines[4] = " <BOOST_PATH>..\..\{}</BOOST_PATH>\n".format( boost_folder) lines[5] = " <GTEST_PATH>..\..\{}</GTEST_PATH>\n".format( gtest_folder) file.seek(0) # clean file first or we leave trailing characters behind with open( os.path.join(build_path, "usvfs", "vsbuild", "external_dependencies.props"), 'w') as file: file.writelines(lines) return True usvfs \ .depend(msbuild.MSBuild("usvfs.sln", vs_target, os.path.join(build_path, "usvfs", "vsbuild"), "{}".format("x64" if config['architecture'] == 'x86_64' else "x86")) .depend(build.Execute(replace_paths) .depend("boost" + suffix) .depend("GTest" + suffix) .depend(github.Source(config['Main_Author'], "usvfs", "0.3.1.0-Beta"))))
except OSError as exception: if exception.errno != errno.EEXIST: raise def install(context): make_sure_path_exists(os.path.join(config["paths"]["install"], "libs")) for f in glob(os.path.join(context['build_path'], "*.lib")): shutil.copy(f, os.path.join(config["paths"]["install"], "libs")) return True Project("Udis86") \ .depend(build.Execute(install) .depend((build.CPP().type(build.STATIC_LIB) .sources("libudis86", ["libudis86/decode.c", "libudis86/itab.c", "libudis86/syn.c", "libudis86/syn-att.c", "libudis86/syn-intel.c", "libudis86/udis86.c"]) .custom("libudis86/itab.c", cmd="{python} scripts/ud_itab.py docs/x86/optable.xml" " libudis86".format(**config["__environment"])) ) .depend(sourceforge.Release("udis86", "udis86/{0}/udis86-{0}.{1}.tar.gz".format(udis_version, udis_version_minor), tree_depth=1)) ) )
import glob from zipfile import ZipFile ip = os.path.join(config["paths"]["install"], "bin") bp = python.python['build_path'] with ZipFile(os.path.join(ip, "python27.zip"), "w") as pyzip: for pattern in patterns: for f in glob.iglob(os.path.join(bp, pattern)): pyzip.write(f, f[len(bp):]) return True Project("python_zip") \ .depend(build.Execute(python_zip_collect) .depend("Python")) if config['transifex_Enable']: from unibuild.projects import translations translationsBuild = Project("translationsBuild").depend("translations") def copy_licenses(context): boost_version = config['boost_version'] boost_tag_version = ".".join( filter(None, [boost_version, config['boost_version_tag']])) license_path = os.path.join(config["paths"]["install"], "bin", "licenses") build_path = config["paths"]["build"] try: os.makedirs(license_path) except: