Update Packaging

- Add changes from OSX build to local hscommon/build.py
- Update package.py & srcpkg.sh
  - Remove invalid submodule references
  - Update srcpkg.sh to use xz
- Update package.py pyinstaller configuration
  - Call PyInstaller inline
  - Add --noconfirm option to be more script friendly
  - Add UCRT Redist location to path should fix #545 as now all the dlls
    are included
This commit is contained in:
Andrew Senetar 2019-12-31 20:28:35 -06:00
parent 7ba8aa3514
commit de8a0a21b2
Signed by: arsenetar
GPG Key ID: C63300DCE48AB2F1
4 changed files with 48 additions and 23 deletions

View File

@ -393,7 +393,11 @@ class TestCaseGetMatches:
eq_(getmatches([]), [])
def test_simple(self):
itemList = [NamedObject("foo bar"), NamedObject("bar bleh"), NamedObject("a b c foo")]
itemList = [
NamedObject("foo bar"),
NamedObject("bar bleh"),
NamedObject("a b c foo"),
]
r = getmatches(itemList)
eq_(2, len(r))
m = first(m for m in r if m.percentage == 50) # "foo bar" and "bar bleh"
@ -514,7 +518,11 @@ class TestCaseGetMatches:
sys.setrecursionlimit(1000)
def test_min_match_percentage(self):
itemList = [NamedObject("foo bar"), NamedObject("bar bleh"), NamedObject("a b c foo")]
itemList = [
NamedObject("foo bar"),
NamedObject("bar bleh"),
NamedObject("a b c foo"),
]
r = getmatches(itemList, min_match_percentage=50)
eq_(1, len(r)) # Only "foo bar" / "bar bleh" should match

View File

@ -480,7 +480,10 @@ def copy_embeddable_python_dylib(dst):
def collect_stdlib_dependencies(script, dest_folder, extra_deps=None):
sysprefix = sys.prefix # could be a virtualenv
real_lib_prefix = sysconfig.get_config_var("LIBDEST")
basesysprefix = sys.base_prefix # seems to be path to non-virtual sys
real_lib_prefix = sysconfig.get_config_var(
"LIBDEST"
) # leaving this in case it is neede
def is_stdlib_path(path):
# A module path is only a stdlib path if it's in either sys.prefix or
@ -490,7 +493,11 @@ def collect_stdlib_dependencies(script, dest_folder, extra_deps=None):
return False
if "site-package" in path:
return False
if not (path.startswith(sysprefix) or path.startswith(real_lib_prefix)):
if not (
path.startswith(sysprefix)
or path.startswith(basesysprefix)
or path.startswith(real_lib_prefix)
):
return False
return True
@ -508,6 +515,10 @@ def collect_stdlib_dependencies(script, dest_folder, extra_deps=None):
"lib/python3."
) # we want to get rid of that lib/python3.x part
relpath = relpath[len("lib/python3.X/") :]
elif p.startswith(basesysprefix):
relpath = op.relpath(p, basesysprefix)
assert relpath.startswith("lib/python3.")
relpath = relpath[len("lib/python3.X/") :]
else:
raise AssertionError()
if relpath.startswith(

View File

@ -133,17 +133,6 @@ def package_source_txz():
build_path = op.join(base_path, "build")
dest = op.join(build_path, name)
print_and_do("git archive -o {} HEAD".format(dest))
# Now, we need to include submodules
SUBMODULES = ["hscommon", "qtlib"]
for submodule in SUBMODULES:
print("Adding submodule {} to archive".format(submodule))
os.chdir(submodule)
archive_path = op.join(build_path, "{}.tar".format(submodule))
print_and_do(
"git archive -o {} --prefix {}/ HEAD".format(archive_path, submodule)
)
os.chdir(base_path)
print_and_do("tar -A {} -f {}".format(archive_path, dest))
print_and_do("xz {}".format(dest))
@ -155,6 +144,10 @@ def package_windows():
version_array = match.group(0).split(".")
match = re.search("[0-9]+", arch)
bits = match.group(0)
if bits == "64":
arch = "x64"
else:
arch = "x86"
# include locale files if they are built otherwise exit as it will break
# the localization
if not op.exists("build/locale"):
@ -179,11 +172,24 @@ def package_windows():
except Exception:
print("Error creating version info file, exiting...")
return
# run pyinstaller via command line
print_and_do(
"pyinstaller -w --name=dupeguru-win{0} --icon=images/dgse_logo.ico "
'--add-data "build/locale;locale" --add-data "build/help;help" '
"--version-file win_version_info.txt run.py".format(bits)
# run pyinstaller from here:
import PyInstaller.__main__
# UCRT dlls are included if the system has the windows kit installed
PyInstaller.__main__.run(
[
"--name=dupeguru-win{0}".format(bits),
"--windowed",
"--noconfirm",
"--icon=images/dgse_logo.ico",
"--add-data=build/locale;locale",
"--add-data=build/help;help",
"--version-file=win_version_info.txt",
"--paths=C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\{0}".format(
arch
),
"run.py",
]
)
# remove version info file
os.remove("win_version_info.txt")

View File

@ -7,7 +7,7 @@ dest="dupeguru-src-${version}.tar"
git archive -o ${dest} HEAD
# Now, we need to include submodules
submodules="hscommon qtlib cocoalib"
submodules="cocoalib"
for submodule in $submodules; do
echo "Adding submodule ${submodule} to archive"
@ -17,5 +17,5 @@ for submodule in $submodules; do
rm ${archive_name}
done
gzip -f ${dest}
echo "Built source package ${dest}.gz"
xz ${dest}
echo "Built source package ${dest}.xz"