mirror of
https://github.com/netinvent/npbackup.git
synced 2024-09-20 14:56:14 +08:00
Compile script: Allow creating only Tar files
This commit is contained in:
parent
8cf3db3533
commit
b74958001a
|
@ -7,8 +7,8 @@ __intname__ = "npbackup.compile"
|
||||||
__author__ = "Orsiris de Jong"
|
__author__ = "Orsiris de Jong"
|
||||||
__copyright__ = "Copyright (C) 2023-2024 NetInvent"
|
__copyright__ = "Copyright (C) 2023-2024 NetInvent"
|
||||||
__license__ = "GPL-3.0-only"
|
__license__ = "GPL-3.0-only"
|
||||||
__build__ = "2024052201"
|
__build__ = "2024090301"
|
||||||
__version__ = "2.0.0"
|
__version__ = "2.0.1"
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -177,12 +177,13 @@ def have_nuitka_commercial():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def compile(arch: str, audience: str, build_type: str, onefile: bool):
|
def compile(arch: str, audience: str, build_type: str, onefile: bool, create_tar_only: bool):
|
||||||
if build_type not in BUILD_TYPES:
|
if build_type not in BUILD_TYPES:
|
||||||
print("CANNOT BUILD BOGUS BUILD TYPE")
|
print("CANNOT BUILD BOGUS BUILD TYPE")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
source_program = "bin/npbackup-{}".format(build_type)
|
source_program = "bin/npbackup-{}".format(build_type)
|
||||||
|
|
||||||
|
|
||||||
if onefile:
|
if onefile:
|
||||||
suffix = "-{}-{}".format(build_type, arch)
|
suffix = "-{}-{}".format(build_type, arch)
|
||||||
|
|
||||||
|
@ -226,6 +227,7 @@ def compile(arch: str, audience: str, build_type: str, onefile: bool):
|
||||||
|
|
||||||
# npbackup compilation
|
# npbackup compilation
|
||||||
# Strip possible version suffixes '-dev'
|
# Strip possible version suffixes '-dev'
|
||||||
|
print(npbackup_version)
|
||||||
_npbackup_version = npbackup_version.split("-")[0]
|
_npbackup_version = npbackup_version.split("-")[0]
|
||||||
PRODUCT_VERSION = _npbackup_version + ".0"
|
PRODUCT_VERSION = _npbackup_version + ".0"
|
||||||
FILE_VERSION = _npbackup_version + ".0"
|
FILE_VERSION = _npbackup_version + ".0"
|
||||||
|
@ -311,8 +313,9 @@ def compile(arch: str, audience: str, build_type: str, onefile: bool):
|
||||||
source_program,
|
source_program,
|
||||||
)
|
)
|
||||||
|
|
||||||
print(CMD)
|
|
||||||
errors = False
|
errors = False
|
||||||
|
if not create_tar_only:
|
||||||
|
print(CMD)
|
||||||
exit_code, output = command_runner(CMD, timeout=0, live_output=True)
|
exit_code, output = command_runner(CMD, timeout=0, live_output=True)
|
||||||
if exit_code != 0:
|
if exit_code != 0:
|
||||||
errors = True
|
errors = True
|
||||||
|
@ -323,6 +326,7 @@ def compile(arch: str, audience: str, build_type: str, onefile: bool):
|
||||||
) as fh:
|
) as fh:
|
||||||
fh.write(npbackup_version)
|
fh.write(npbackup_version)
|
||||||
print(f"COMPILED {'WITH SUCCESS' if not errors else 'WITH ERRORS'}")
|
print(f"COMPILED {'WITH SUCCESS' if not errors else 'WITH ERRORS'}")
|
||||||
|
|
||||||
if not onefile:
|
if not onefile:
|
||||||
if not create_archive(
|
if not create_archive(
|
||||||
platform=platform,
|
platform=platform,
|
||||||
|
@ -413,6 +417,14 @@ if __name__ == "__main__":
|
||||||
help="Build single file executable (more prone to AV detection)",
|
help="Build single file executable (more prone to AV detection)",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--create-tar-only",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
required=False,
|
||||||
|
help="Only create tar files, shortcut when we need to package signed binaries"
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Make sure we get out dev environment back when compilation ends / fails
|
# Make sure we get out dev environment back when compilation ends / fails
|
||||||
|
@ -420,6 +432,7 @@ if __name__ == "__main__":
|
||||||
move_audience_files,
|
move_audience_files,
|
||||||
"private",
|
"private",
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
errors = False
|
errors = False
|
||||||
if args.audience.lower() == "all":
|
if args.audience.lower() == "all":
|
||||||
|
@ -435,11 +448,14 @@ if __name__ == "__main__":
|
||||||
else:
|
else:
|
||||||
build_types = BUILD_TYPES
|
build_types = BUILD_TYPES
|
||||||
|
|
||||||
|
create_tar_only = args.create_tar_only
|
||||||
|
|
||||||
for audience in audiences:
|
for audience in audiences:
|
||||||
move_audience_files(audience)
|
|
||||||
npbackup_version = get_metadata(os.path.join(BASEDIR, "__version__.py"))[
|
npbackup_version = get_metadata(os.path.join(BASEDIR, "__version__.py"))[
|
||||||
"version"
|
"version"
|
||||||
]
|
]
|
||||||
|
if not create_tar_only:
|
||||||
|
move_audience_files(audience)
|
||||||
|
|
||||||
private_build = check_private_build(audience)
|
private_build = check_private_build(audience)
|
||||||
if private_build and audience != "private":
|
if private_build and audience != "private":
|
||||||
|
@ -456,7 +472,9 @@ if __name__ == "__main__":
|
||||||
audience=audience,
|
audience=audience,
|
||||||
build_type=build_type,
|
build_type=build_type,
|
||||||
onefile=args.onefile,
|
onefile=args.onefile,
|
||||||
|
create_tar_only=create_tar_only
|
||||||
)
|
)
|
||||||
|
if not create_tar_only:
|
||||||
audience_build = "private" if private_build else "public"
|
audience_build = "private" if private_build else "public"
|
||||||
if result:
|
if result:
|
||||||
print(
|
print(
|
||||||
|
|
Loading…
Reference in a new issue