def main(): nuitka_version = getNuitkaVersion() branch_name = checkBranchName() # Only real master releases so far. assert branch_name == "master", branch_name assert "pre" not in nuitka_version and "rc" not in nuitka_version print("Uploading Nuitka '%s'" % nuitka_version) # Need to remove the contents from the Rest, or else PyPI will not render # it. Stupid but true. contents = open("README.rst", "rb").read() contents = contents.replace(b".. contents::\n", b"") contents = contents.replace( b".. image:: doc/images/Nuitka-Logo-Symbol.png\n", b"") contents = contents.replace( b".. raw:: pdf\n\n PageBreak oneColumn\n SetPageCounter 1", b"") open("README.rst", "wb").write(contents) # Make sure it worked. contents = open("README.rst", "rb").read() assert b".. contents" not in contents print("Creating documentation.") createReleaseDocumentation() print("Creating source distribution.") assert os.system("python setup.py sdist") == 0 print("Uploading source dist") assert os.system("twine upload dist/*") print("Uploaded.")
def main(): nuitka_version = getNuitkaVersion() branch_name = checkBranchName() # Only real master releases so far. assert branch_name == "master", branch_name assert "pre" not in nuitka_version and "rc" not in nuitka_version print("Uploading Nuitka '%s'" % nuitka_version) # Need to remove the contents from the Rest, or else PyPI will not render # it. Stupid but true. with open("README.rst", "rb") as f: contents = f.read() contents = contents.replace(b".. contents::\n", b"") contents = contents.replace( b".. image:: doc/images/Nuitka-Logo-Symbol.png\n", b"") contents = contents.replace( b".. raw:: pdf\n\n PageBreak oneColumn\n SetPageCounter 1", b"") with open("README.rst", "wb") as f: f.write(contents) # Make sure it worked. with open("README.rst", "rb") as f: contents = f.read() assert b".. contents" not in contents shutil.rmtree("check_nuitka", ignore_errors=True) shutil.rmtree("dist", ignore_errors=True) print("Creating documentation.") createReleaseDocumentation() print("Creating source distribution.") assert os.system( "umask 0022 && chmod -R a+rX . && python setup.py sdist") == 0 print("Creating a virtualenv for quick test:") with withVirtualenv("check_nuitka") as venv: print("Installing Nuitka into virtualenv:") print("*" * 40) venv.runCommand("python -m pip install ../dist/Nuitka*.tar.gz") print("*" * 40) print("Compiling basic test:") print("*" * 40) venv.runCommand("nuitka-run ../tests/basics/Asserts.py") print("*" * 40) if "check" not in sys.argv: print("Uploading source dist") assert os.system("twine upload dist/*") == 0 print("Uploaded.") else: print("Checked OK, not uploaded.")
def main(): branch_name = checkBranchName() assert branch_name == "main" createReleaseDocumentation() assert os.system("python setup.py sdist --formats=gztar") == 0 os.chdir("dist") # Clean the stage for the debian package. The name "deb_dist" is what "py2dsc" # uses for its output later on. shutil.rmtree("deb_dist", ignore_errors=True) # Provide a re-packed tar.gz for the Debian package as input. # Create it as a "+ds" file, removing: # - the benchmarks (too many sources, not useful to end users, potential license # issues) # - the inline copy of scons (not wanted for Debian) # Then run "py2dsc" on it. for filename in os.listdir("."): if filename.endswith(".tar.gz"): new_name = filename[:-7] + "+ds.tar.gz" cleanupTarfileForDebian(filename, new_name) entry = runPy2dsc(filename, new_name) break else: assert False os.chdir("deb_dist") os.chdir(entry) # Build the debian package, but disable the running of tests, will be done later # in the pbuilder test steps. assert os.system("debuild --set-envvar=DEB_BUILD_OPTIONS=nocheck") == 0 os.chdir("../../..") assert os.path.exists("dist/deb_dist") # Cleanup the build directory, not needed anymore. shutil.rmtree("build", ignore_errors=True) my_print("Uploading...", style="blue") os.chdir("dist/deb_dist") assert os.system("dput mentors *.changes") == 0 my_print("Finished.", style="blue")
def main(): nuitka_version = getNuitkaVersion() branch_name = checkBranchName() check_mode = "--check" in sys.argv # Only real main releases so far. if not check_mode: assert branch_name == "main", branch_name assert "pre" not in nuitka_version and "rc" not in nuitka_version my_print("Working on Nuitka %r." % nuitka_version, style="blue") shutil.rmtree("check_nuitka", ignore_errors=True) shutil.rmtree("dist", ignore_errors=True) my_print("Creating documentation.", style="blue") createReleaseDocumentation() my_print("Creating source distribution.", style="blue") assert os.system("umask 0022 && chmod -R a+rX . && python setup.py sdist") == 0 with withVirtualenv("venv_nuitka", style="blue") as venv: my_print("Installing Nuitka into virtualenv:", style="blue") my_print("*" * 40, style="blue") venv.runCommand("python -m pip install ../dist/Nuitka*.tar.gz") my_print("*" * 40, style="blue") my_print("Compiling basic test with runner:", style="blue") my_print("*" * 40, style="blue") venv.runCommand( "nuitka%d-run ../tests/basics/Asserts.py" % sys.version_info[0], style="blue", ) my_print("*" * 40, style="blue") my_print("Compiling basic test with recommended -m mode:", style="blue") my_print("*" * 40, style="blue") venv.runCommand( "python -m nuitka ../tests/basics/Asserts.py", style="blue", ) my_print("*" * 40, style="blue") assert os.system("twine check dist/*") == 0 if not check_mode: my_print("Uploading source dist") assert os.system("twine upload dist/*") == 0 my_print("Uploaded.") else: my_print("Checked OK, but not uploaded.")
def main(): nuitka_version = getNuitkaVersion() branch_name = checkBranchName() shutil.rmtree("dist", ignore_errors=True) shutil.rmtree("build", ignore_errors=True) createReleaseDocumentation() assert os.system("python setup.py sdist --formats=gztar") == 0 # Upload stable releases to OpenSUSE Build Service: if ( branch_name.startswith("release") or branch_name.startswith("hotfix") or branch_name == "main" ): osc_project_name = "Nuitka" spec_suffix = "" elif branch_name == "develop": osc_project_name = "Nuitka-Unstable" spec_suffix = "-unstable" elif branch_name == "factory": osc_project_name = "Nuitka-experimental" spec_suffix = "-experimental" else: sys.exit("Skipping OSC for branch '%s'" % branch_name) # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) os.makedirs("osc") # Stage the "osc" checkout from the ground up. assert ( os.system( f"""\ cd osc && \ osc checkout home:kayhayen {osc_project_name} && \ rm home:kayhayen/{osc_project_name}/* && \ cp ../dist/Nuitka-*.tar.gz home:kayhayen/{osc_project_name}/ && \ sed -e s/VERSION/{nuitka_version}/ ../rpm/nuitka.spec >home:kayhayen/{osc_project_name}/nuitka{spec_suffix}.spec && \ sed -i home:kayhayen/{osc_project_name}/nuitka{spec_suffix}.spec -e \ 's/Name: *nuitka/Name: nuitka{spec_suffix}/' && \ cp ../rpm/nuitka-rpmlintrc home:kayhayen/{osc_project_name}/ && \ cd home:kayhayen/{osc_project_name}/ && \ osc addremove -r && \ echo 'New release' >ci_message && \ osc ci --file ci_message """ ) == 0 )
def createMSIPackage(): if os.path.isdir("dist"): shutil.rmtree("dist") branch_name = checkBranchName() print("Building for branch '%s'." % branch_name) assert branch_name in ( "master", "develop", "factory", ), branch_name assert subprocess.call((sys.executable, "setup.py", "bdist_msi", "--target-version=" + sys.version[:3])) == 0 filename = None # pylint happiness. for filename in os.listdir("dist"): if filename.endswith(".msi"): break else: sys.exit("No MSI created.") new_filename = makeMsiCompatibleFilename(filename) if branch_name == b"factory": new_filename = "Nuitka-factory." + new_filename[new_filename.find("win" ):] result = os.path.join("dist", new_filename) os.rename(os.path.join("dist", filename), result) print("OK, created as dist/" + new_filename) return result
os.path.dirname(__file__), "..", ) ) ) from nuitka.tools.release.Release import checkAtHome, checkBranchName from nuitka.utils.Execution import check_output checkAtHome() nuitka_version = check_output( "./bin/nuitka --version", shell = True ).strip() branch_name = checkBranchName() if branch_name == "factory": for remote in "origin", "github": assert 0 == os.system("git push --recurse-submodules=no --force-with-lease %s factory" % remote) sys.exit(0) assert 0 == os.system("rsync -rvlpt --exclude=deb_dist dist/ [email protected]:/var/www/releases/") for filename in ("README.pdf", "Changelog.pdf", "Developer_Manual.pdf"): assert 0 == os.system("rsync %s [email protected]:/var/www/doc/" % filename) # Upload only stable releases to OpenSUSE Build Service: if branch_name.startswith("release") or branch_name == "master": pass
def main(): # Complex stuff, pylint: disable=too-many-statements # Make sure error messages are in English. os.environ["LANG"] = "C" parser = OptionParser() parser.add_option( "--no-pbuilder-update", action="store_false", dest="update_pbuilder", default=True, help="""\ Update the pbuilder chroot before building. Default %default.""", ) options, positional_args = parser.parse_args() assert len(positional_args) == 1, positional_args codename = positional_args[0] nuitka_version = getNuitkaVersion() branch_name = checkBranchName() category = getBranchCategory(branch_name) if category == "stable": if nuitka_version.count(".") == 1: assert checkChangeLog("New upstream release.") else: assert checkChangeLog("New upstream hotfix release.") else: assert checkChangeLog("New upstream pre-release.") shutil.rmtree("dist", ignore_errors=True) shutil.rmtree("build", ignore_errors=True) createReleaseDocumentation() assert os.system("python setup.py sdist --formats=gztar") == 0 os.chdir("dist") # Clean the stage for the debian package. The name "deb_dist" is what "py2dsc" # uses for its output later on. shutil.rmtree("deb_dist", ignore_errors=True) # Provide a re-packed tar.gz for the Debian package as input. # Create it as a "+ds" file, removing: # - the benchmarks (too many sources, not useful to end users, potential license # issues) # - the inline copy of scons (not wanted for Debian) for filename in os.listdir("."): if filename.endswith(".tar.gz"): new_name = filename[:-7] + "+ds.tar.gz" cleanupTarfileForDebian(filename, new_name) entry = runPy2dsc(filename, new_name) break else: assert False os.chdir("deb_dist") os.chdir(entry) # Build the debian package, but disable the running of tests, will be done later # in the pbuilder test steps. assert os.system("debuild --set-envvar=DEB_BUILD_OPTIONS=nocheck") == 0 os.chdir("../../..") assert os.path.exists("dist/deb_dist") # Check with pylint in pedantic mode and don't proceed if there were any # warnings given. Nuitka is lintian clean and shall remain that way. For # hotfix releases, i.e. "stable" builds, we skip this test though. if category == "stable": my_print("Skipped lintian checks for stable releases.", style="blue") else: assert os.system( "lintian --pedantic --allow-root dist/deb_dist/*.changes") == 0 # Move the created debian package files out. os.system("cp dist/deb_dist/*.deb dist/") # Build inside the pbuilder chroot, and output to dedicated directory. shutil.rmtree("package", ignore_errors=True) os.makedirs("package") # Now update the pbuilder. if options.update_pbuilder: command = """\ sudo /usr/sbin/pbuilder --update --basetgz /var/cache/pbuilder/%s.tgz""" % ( codename) assert os.system(command) == 0, codename (dsc_filename, ) = resolveShellPatternToFilenames("dist/deb_dist/*.dsc") # Execute the package build in the pbuilder with tests. command = ( "sudo", "/usr/sbin/pbuilder", "--build", "--basetgz", "/var/cache/pbuilder/%s.tgz" % codename, "--hookdir", "debian/pbuilder-hookdir", "--debemail", "Kay Hayen <*****@*****.**>", "--buildresult", "package", dsc_filename, ) check_call(command, shell=False) # Cleanup the build directory, not needed anymore. shutil.rmtree("build", ignore_errors=True) # Now build the repository. my_print("Building repository ...", style="blue") os.chdir("package") os.makedirs("repo") os.chdir("repo") os.makedirs("conf") putTextFileContents( "conf/distributions", contents="""\ Origin: Nuitka Label: Nuitka Codename: %(codename)s Architectures: i386 amd64 armel armhf powerpc Components: main Description: Apt repository for project Nuitka %(codename)s SignWith: D96ADCA1377F1CEB6B5103F11BFC33752912B99C """ % {"codename": codename}, ) command = ["reprepro", "includedeb", codename] command.extend(resolveShellPatternToFilenames("../*.deb")) check_call(command, shell=False) my_print("Uploading ...", style="blue") # Create repo folder unless already done. This is needed for the first # build only. assert (os.system("ssh [email protected] mkdir -p /var/www/deb/%s/%s/" % (category, codename)) == 0) # Update the repository on the web site. assert (os.system( "rsync -avz --delete dists pool --chown www-data [email protected]:/var/www/deb/%s/%s/" % (category, codename)) == 0) my_print("Finished.", style="blue")
dest="ds_source", default=None, help="""\ When given, use this as the source for the Debian package instead. Default \ %default.""") options, positional_args = parser.parse_args() assert not positional_args, positional_args checkAtHome() from nuitka.Version import getNuitkaVersion nuitka_version = getNuitkaVersion() branch_name = checkBranchName() from nuitka.tools.release.Release import checkNuitkaChangelog if branch_name.startswith("release") or \ branch_name == "master" or \ branch_name.startswith("hotfix/"): if nuitka_version.count('.') == 2: assert checkChangeLog("New upstream release.") else: assert checkChangeLog("New upstream hotfix release.") assert checkNuitkaChangelog() == "final", checkNuitkaChangelog() else: assert checkChangeLog("New upstream pre-release."), branch_name assert checkNuitkaChangelog() == "draft", checkNuitkaChangelog()
def main(): branch_name = checkBranchName() assert branch_name == "master" createReleaseDocumentation() assert os.system("python setup.py sdist --formats=gztar") == 0 os.chdir("dist") # Clean the stage for the debian package. The name "deb_dist" is what "py2dsc" # uses for its output later on. shutil.rmtree("deb_dist", ignore_errors=True) # Provide a re-packed tar.gz for the Debian package as input. # Create it as a "+ds" file, removing: # - the benchmarks (too many sources, not useful to end users, potential license # issues) # - the inline copy of scons (not wanted for Debian) # Then run "py2dsc" on it. for filename in os.listdir("."): if filename.endswith(".tar.gz"): new_name = filename[:-7] + "+ds.tar.gz" cleanupTarfileForDebian(filename, new_name) assert os.system("py2dsc " + new_name) == 0 # Fixup for py2dsc not taking our custom suffix into account, so we need # to rename it ourselves. before_deb_name = filename[:-7].lower().replace("-", "_") after_deb_name = before_deb_name.replace("rc", "~rc") assert (os.system( "mv 'deb_dist/%s.orig.tar.gz' 'deb_dist/%s+ds.orig.tar.gz'" % (before_deb_name, after_deb_name)) == 0) assert os.system("rm -f deb_dist/*_source*") == 0 # Remove the now useless input, py2dsc has copied it, and we don't # publish it. os.unlink(new_name) break else: assert False os.chdir("deb_dist") # Assert that the unpacked directory is there. Otherwise fail badly. for entry in os.listdir("."): if (os.path.isdir(entry) and entry.startswith("nuitka") and not entry.endswith(".orig")): break else: assert False # We know the dir is not empty, pylint: disable=undefined-loop-variable # Import the "debian" directory from above. It's not in the original tar and # overrides or extends what py2dsc does. assert (os.system( "rsync -a --exclude pbuilder-hookdir ../../debian/ %s/debian/" % entry) == 0) # Remove now unnecessary files. assert os.system("rm *.dsc *.debian.tar.[gx]z") == 0 os.chdir(entry) # Build the debian package, but disable the running of tests, will be done later # in the pbuilder test steps. assert os.system("debuild --set-envvar=DEB_BUILD_OPTIONS=nocheck") == 0 os.chdir("../../..") assert os.path.exists("dist/deb_dist") # Cleanup the build directory, not needed anymore. shutil.rmtree("build", ignore_errors=True) print("Uploading...") os.chdir("dist/deb_dist") assert os.system("dput mentors *.changes") == 0 print("Finished.")
def main(): # Complex stuff, pylint: disable=too-many-branches,too-many-statements # Make sure error messages are in English. os.environ["LANG"] = "C" parser = OptionParser() parser.add_option( "--no-pbuilder-update", action="store_false", dest="update_pbuilder", default=True, help="""\ Update the pbuilder chroot before building. Default %default.""", ) options, positional_args = parser.parse_args() assert len(positional_args) == 1, positional_args codename = positional_args[0] nuitka_version = getNuitkaVersion() branch_name = checkBranchName() category = getBranchCategory(branch_name) if category == "stable": if nuitka_version.count(".") == 2: assert checkChangeLog("New upstream release.") else: assert checkChangeLog("New upstream hotfix release.") else: assert checkChangeLog("New upstream pre-release.") shutil.rmtree("dist", ignore_errors=True) shutil.rmtree("build", ignore_errors=True) createReleaseDocumentation() assert os.system("python setup.py sdist --formats=gztar") == 0 os.chdir("dist") # Clean the stage for the debian package. The name "deb_dist" is what "py2dsc" # uses for its output later on. shutil.rmtree("deb_dist", ignore_errors=True) # Provide a re-packed tar.gz for the Debian package as input. # Create it as a "+ds" file, removing: # - the benchmarks (too many sources, not useful to end users, potential license # issues) # - the inline copy of scons (not wanted for Debian) # Then run "py2dsc" on it. for filename in os.listdir("."): if filename.endswith(".tar.gz"): new_name = filename[:-7] + "+ds.tar.gz" cleanupTarfileForDebian(filename, new_name) assert os.system("py2dsc " + new_name) == 0 # Fixup for py2dsc not taking our custom suffix into account, so we need # to rename it ourselves. before_deb_name = filename[:-7].lower().replace("-", "_") after_deb_name = before_deb_name.replace("rc", "~rc") assert (os.system( "mv 'deb_dist/%s.orig.tar.gz' 'deb_dist/%s+ds.orig.tar.gz'" % (before_deb_name, after_deb_name)) == 0) assert os.system("rm -f deb_dist/*_source*") == 0 # Remove the now useless input, py2dsc has copied it, and we don't # publish it. os.unlink(new_name) break else: assert False os.chdir("deb_dist") # Assert that the unpacked directory is there. Otherwise fail badly. for entry in os.listdir("."): if (os.path.isdir(entry) and entry.startswith("nuitka") and not entry.endswith(".orig")): break else: assert False # We know the dir is not empty, pylint: disable=undefined-loop-variable # Import the "debian" directory from above. It's not in the original tar and # overrides or extends what py2dsc does. assert (os.system( "rsync -a --exclude pbuilder-hookdir ../../debian/ %s/debian/" % entry) == 0) # Remove now unnecessary files. assert os.system("rm *.dsc *.debian.tar.[gx]z") == 0 os.chdir(entry) # Build the debian package, but disable the running of tests, will be done later # in the pbuilder test steps. assert os.system("debuild --set-envvar=DEB_BUILD_OPTIONS=nocheck") == 0 os.chdir("../../..") assert os.path.exists("dist/deb_dist") # Check with pylint in pedantic mode and don't proceed if there were any # warnings given. Nuitka is lintian clean and shall remain that way. For # hotfix releases, i.e. "stable" builds, we skip this test though. if category == "stable": print("Skipped lintian checks for stable releases.") else: assert (os.system( "lintian --pedantic --fail-on-warnings --allow-root dist/deb_dist/*.changes" ) == 0) # Move the created debian package files out. os.system("cp dist/deb_dist/*.deb dist/") # Build inside the pbuilder chroot, and output to dedicated directory. shutil.rmtree("package", ignore_errors=True) os.makedirs("package") # Now update the pbuilder. if options.update_pbuilder: command = """\ sudo /usr/sbin/pbuilder --update --basetgz /var/cache/pbuilder/%s.tgz""" % ( codename) assert os.system(command) == 0, codename # Execute the package build in the pbuilder with tests. command = ("""\ sudo /usr/sbin/pbuilder --build --basetgz /var/cache/pbuilder/%s.tgz \ --hookdir debian/pbuilder-hookdir --debemail "Kay Hayen <*****@*****.**>" \ --buildresult package dist/deb_dist/*.dsc""" % codename) assert os.system(command) == 0, codename # Cleanup the build directory, not needed anymore. shutil.rmtree("build", ignore_errors=True) # Now build the repository. os.chdir("package") os.makedirs("repo") os.chdir("repo") os.makedirs("conf") with open("conf/distributions", "w") as output: output.write("""\ Origin: Nuitka Label: Nuitka Codename: %(codename)s Architectures: i386 amd64 armel armhf powerpc Components: main Description: Apt repository for project Nuitka %(codename)s SignWith: 2912B99C """ % {"codename": codename}) assert os.system("reprepro includedeb %s ../*.deb" % codename) == 0 print("Uploading...") # Create repo folder unless already done. This is needed for the first # build only. assert (os.system("ssh [email protected] mkdir -p /var/www/deb/%s/%s/" % (category, codename)) == 0) # Update the repository on the web site. assert (os.system( "rsync -avz --delete dists pool --chown www-data [email protected]:/var/www/deb/%s/%s/" % (category, codename)) == 0) print("Finished.")
def main(): nuitka_version = getNuitkaVersion() branch_name = checkBranchName() shutil.rmtree("dist", ignore_errors=True) shutil.rmtree("build", ignore_errors=True) createReleaseDocumentation() assert os.system("python setup.py sdist --formats=gztar") == 0 # Upload stable releases to OpenSUSE Build Service: if branch_name.startswith("release") or \ branch_name.startswith("hotfix") or \ branch_name == "master": # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) os.makedirs("osc") # Stage the "osc" checkout from the ground up. assert os.system("""\ cd osc && \ osc init home:kayhayen Nuitka && osc repairwc && \ cp ../dist/Nuitka-*.tar.gz . && \ sed -e s/VERSION/%s/ ../rpm/nuitka.spec >./nuitka.spec && \ cp ../rpm/nuitka-rpmlintrc . && \ osc addremove && \ echo 'New release' >ci_message && \ osc ci --file ci_message """ % nuitka_version) == 0 # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) elif branch_name == "develop": # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) os.makedirs("osc") # Stage the "osc" checkout from the ground up, but path the RPM spec to say # it is nuitks-unstable package. assert os.system("""\ cd osc && \ osc init home:kayhayen Nuitka-Unstable && \ osc repairwc && \ cp ../dist/Nuitka-*.tar.gz . && \ sed -e s/VERSION/%s/ ../rpm/nuitka.spec >./nuitka-unstable.spec && \ sed -i nuitka-unstable.spec -e 's/Name: *nuitka/Name: nuitka-unstable/' && \ cp ../rpm/nuitka-rpmlintrc . && \ osc addremove && echo 'New release' >ci_message && \ osc ci --file ci_message """ % nuitka_version) == 0 # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) elif branch_name == "factory": # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) os.makedirs("osc") # Stage the "osc" checkout from the ground up, but path the RPM spec to say # it is nuitks-unstable package. assert os.system("""\ cd osc && \ osc init home:kayhayen Nuitka-experimental && \ osc repairwc && \ cp ../dist/Nuitka-*.tar.gz . && \ sed -e s/VERSION/%s/ ../rpm/nuitka.spec >./nuitka-experimental.spec && \ sed -i nuitka-experimental.spec -e 's/Name: *nuitka/Name: nuitka-experimental/' && \ cp ../rpm/nuitka-rpmlintrc . && \ osc addremove && \ echo 'New release' >ci_message && osc ci --file ci_message """ % nuitka_version) == 0 # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) else: sys.exit("Skipping OSC for branch '%s'" % branch_name)
def main(): # Complex stuff, pylint: disable=too-many-branches,too-many-statements # Make sure error messages are in English. os.environ["LANG"] = "C" parser = OptionParser() parser.add_option( "--no-pbuilder-update", action="store_false", dest="update_pbuilder", default=True, help="""\ Update the pbuilder chroot before building. Default %default.""", ) options, positional_args = parser.parse_args() assert len(positional_args) == 1, positional_args codename = positional_args[0] nuitka_version = getNuitkaVersion() branch_name = checkBranchName() category = getBranchCategory(branch_name) if category == "stable": if nuitka_version.count(".") == 2: assert checkChangeLog("New upstream release.") else: assert checkChangeLog("New upstream hotfix release.") else: assert checkChangeLog("New upstream pre-release.") shutil.rmtree("dist", ignore_errors=True) shutil.rmtree("build", ignore_errors=True) createReleaseDocumentation() assert os.system("python setup.py sdist --formats=gztar") == 0 os.chdir("dist") # Clean the stage for the debian package. The name "deb_dist" is what "py2dsc" # uses for its output later on. shutil.rmtree("deb_dist", ignore_errors=True) # Provide a re-packed tar.gz for the Debian package as input. # Create it as a "+ds" file, removing: # - the benchmarks (too many sources, not useful to end users, potential license # issues) # - the inline copy of scons (not wanted for Debian) # Then run "py2dsc" on it. for filename in os.listdir("."): if filename.endswith(".tar.gz"): new_name = filename[:-7] + "+ds.tar.gz" cleanupTarfileForDebian(filename, new_name) assert os.system("py2dsc " + new_name) == 0 # Fixup for py2dsc not taking our custom suffix into account, so we need # to rename it ourselves. before_deb_name = filename[:-7].lower().replace("-", "_") after_deb_name = before_deb_name.replace("rc", "~rc") assert ( os.system( "mv 'deb_dist/%s.orig.tar.gz' 'deb_dist/%s+ds.orig.tar.gz'" % (before_deb_name, after_deb_name) ) == 0 ) assert os.system("rm -f deb_dist/*_source*") == 0 # Remove the now useless input, py2dsc has copied it, and we don't # publish it. os.unlink(new_name) break else: assert False os.chdir("deb_dist") # Assert that the unpacked directory is there. Otherwise fail badly. for entry in os.listdir("."): if ( os.path.isdir(entry) and entry.startswith("nuitka") and not entry.endswith(".orig") ): break else: assert False # We know the dir is not empty, pylint: disable=undefined-loop-variable # Import the "debian" directory from above. It's not in the original tar and # overrides or extends what py2dsc does. assert ( os.system( "rsync -a --exclude pbuilder-hookdir ../../debian/ %s/debian/" % entry ) == 0 ) # Remove now unnecessary files. assert os.system("rm *.dsc *.debian.tar.[gx]z") == 0 os.chdir(entry) # Build the debian package, but disable the running of tests, will be done later # in the pbuilder test steps. assert os.system("debuild --set-envvar=DEB_BUILD_OPTIONS=nocheck") == 0 os.chdir("../../..") assert os.path.exists("dist/deb_dist") # Check with pylint in pedantic mode and don't proceed if there were any # warnings given. Nuitka is lintian clean and shall remain that way. For # hotfix releases, i.e. "stable" builds, we skip this test though. if category == "stable": print("Skipped lintian checks for stable releases.") else: assert ( os.system( "lintian --pedantic --fail-on-warnings --allow-root dist/deb_dist/*.changes" ) == 0 ) # Move the created debian package files out. os.system("cp dist/deb_dist/*.deb dist/") # Build inside the pbuilder chroot, and output to dedicated directory. shutil.rmtree("package", ignore_errors=True) os.makedirs("package") # Now update the pbuilder. if options.update_pbuilder: command = """\ sudo /usr/sbin/pbuilder --update --basetgz /var/cache/pbuilder/%s.tgz""" % ( codename ) assert os.system(command) == 0, codename # Execute the package build in the pbuilder with tests. command = ( """\ sudo /usr/sbin/pbuilder --build --basetgz /var/cache/pbuilder/%s.tgz \ --hookdir debian/pbuilder-hookdir --debemail "Kay Hayen <*****@*****.**>" \ --buildresult package dist/deb_dist/*.dsc""" % codename ) assert os.system(command) == 0, codename # Cleanup the build directory, not needed anymore. shutil.rmtree("build", ignore_errors=True) # Now build the repository. os.chdir("package") os.makedirs("repo") os.chdir("repo") os.makedirs("conf") with open("conf/distributions", "w") as output: output.write( """\ Origin: Nuitka Label: Nuitka Codename: %(codename)s Architectures: i386 amd64 armel armhf powerpc Components: main Description: Apt repository for project Nuitka %(codename)s SignWith: 2912B99C """ % {"codename": codename} ) assert os.system("reprepro includedeb %s ../*.deb" % codename) == 0 print("Uploading...") # Create repo folder unless already done. This is needed for the first # build only. assert ( os.system( "ssh [email protected] mkdir -p /var/www/deb/%s/%s/" % (category, codename) ) == 0 ) # Update the repository on the web site. assert ( os.system( "rsync -avz --delete dists pool --chown www-data [email protected]:/var/www/deb/%s/%s/" % (category, codename) ) == 0 ) print("Finished.")
def main(): branch_name = checkBranchName() assert branch_name == "master" createReleaseDocumentation() assert os.system("python setup.py sdist --formats=gztar") == 0 os.chdir("dist") # Clean the stage for the debian package. The name "deb_dist" is what "py2dsc" # uses for its output later on. shutil.rmtree("deb_dist", ignore_errors=True) # Provide a re-packed tar.gz for the Debian package as input. # Create it as a "+ds" file, removing: # - the benchmarks (too many sources, not useful to end users, potential license # issues) # - the inline copy of scons (not wanted for Debian) # Then run "py2dsc" on it. for filename in os.listdir("."): if filename.endswith(".tar.gz"): new_name = filename[:-7] + "+ds.tar.gz" cleanupTarfileForDebian(filename, new_name) assert os.system("py2dsc " + new_name) == 0 # Fixup for py2dsc not taking our custom suffix into account, so we need # to rename it ourselves. before_deb_name = filename[:-7].lower().replace("-", "_") after_deb_name = before_deb_name.replace("rc", "~rc") assert ( os.system( "mv 'deb_dist/%s.orig.tar.gz' 'deb_dist/%s+ds.orig.tar.gz'" % (before_deb_name, after_deb_name) ) == 0 ) assert os.system("rm -f deb_dist/*_source*") == 0 # Remove the now useless input, py2dsc has copied it, and we don't # publish it. os.unlink(new_name) break else: assert False os.chdir("deb_dist") # Assert that the unpacked directory is there. Otherwise fail badly. for entry in os.listdir("."): if ( os.path.isdir(entry) and entry.startswith("nuitka") and not entry.endswith(".orig") ): break else: assert False # We know the dir is not empty, pylint: disable=undefined-loop-variable # Import the "debian" directory from above. It's not in the original tar and # overrides or extends what py2dsc does. assert ( os.system( "rsync -a --exclude pbuilder-hookdir ../../debian/ %s/debian/" % entry ) == 0 ) # Remove now unnecessary files. assert os.system("rm *.dsc *.debian.tar.[gx]z") == 0 os.chdir(entry) # Build the debian package, but disable the running of tests, will be done later # in the pbuilder test steps. assert os.system("debuild --set-envvar=DEB_BUILD_OPTIONS=nocheck") == 0 os.chdir("../../..") assert os.path.exists("dist/deb_dist") # Cleanup the build directory, not needed anymore. shutil.rmtree("build", ignore_errors=True) print("Uploading...") os.chdir("dist/deb_dist") assert os.system("dput mentors *.changes") == 0 print("Finished.")
def main(): nuitka_version = getNuitkaVersion() branch_name = checkBranchName() shutil.rmtree("dist", ignore_errors=True) shutil.rmtree("build", ignore_errors=True) createReleaseDocumentation() assert os.system("python setup.py sdist --formats=gztar") == 0 # Upload stable releases to OpenSUSE Build Service: if ( branch_name.startswith("release") or branch_name.startswith("hotfix") or branch_name == "master" ): # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) os.makedirs("osc") # Stage the "osc" checkout from the ground up. assert ( os.system( """\ cd osc && \ osc init home:kayhayen Nuitka && osc repairwc && \ cp ../dist/Nuitka-*.tar.gz . && \ sed -e s/VERSION/%s/ ../rpm/nuitka.spec >./nuitka.spec && \ cp ../rpm/nuitka-rpmlintrc . && \ osc addremove && \ echo 'New release' >ci_message && \ osc ci --file ci_message """ % nuitka_version ) == 0 ) # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) elif branch_name == "develop": # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) os.makedirs("osc") # Stage the "osc" checkout from the ground up, but path the RPM spec to say # it is nuitks-unstable package. assert ( os.system( """\ cd osc && \ osc init home:kayhayen Nuitka-Unstable && \ osc repairwc && \ cp ../dist/Nuitka-*.tar.gz . && \ sed -e s/VERSION/%s/ ../rpm/nuitka.spec >./nuitka-unstable.spec && \ sed -i nuitka-unstable.spec -e 's/Name: *nuitka/Name: nuitka-unstable/' && \ cp ../rpm/nuitka-rpmlintrc . && \ osc addremove && echo 'New release' >ci_message && \ osc ci --file ci_message """ % nuitka_version ) == 0 ) # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) elif branch_name == "factory": # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) os.makedirs("osc") # Stage the "osc" checkout from the ground up, but path the RPM spec to say # it is nuitks-unstable package. assert ( os.system( """\ cd osc && \ osc init home:kayhayen Nuitka-experimental && \ osc repairwc && \ cp ../dist/Nuitka-*.tar.gz . && \ sed -e s/VERSION/%s/ ../rpm/nuitka.spec >./nuitka-experimental.spec && \ sed -i nuitka-experimental.spec -e 's/Name: *nuitka/Name: nuitka-experimental/' && \ cp ../rpm/nuitka-rpmlintrc . && \ osc addremove && \ echo 'New release' >ci_message && osc ci --file ci_message """ % nuitka_version ) == 0 ) # Cleanup the osc directory. shutil.rmtree("osc", ignore_errors=True) else: sys.exit("Skipping OSC for branch '%s'" % branch_name)