Merge branch 'master' into 'master'
WindowsBuild: Install Gajim as a python package See merge request !118
This commit is contained in:
commit
ca0a4c9817
|
@ -29,6 +29,7 @@ function set_build_root {
|
|||
BUILD_ROOT="$1"
|
||||
REPO_CLONE="${BUILD_ROOT}/${MINGW}"/gajim
|
||||
MINGW_ROOT="${BUILD_ROOT}/${MINGW}"
|
||||
PACKAGE_DIR="${BUILD_ROOT}/${MINGW}/lib/python3.6/site-packages"
|
||||
}
|
||||
|
||||
set_build_root "${DIR}/_build_root"
|
||||
|
@ -120,8 +121,10 @@ pillow
|
|||
function install_gajim {
|
||||
[ -z "$1" ] && (echo "Missing arg"; exit 1)
|
||||
|
||||
rm -Rf "${PACKAGE_DIR}/gajim"
|
||||
rm -Rf "${REPO_CLONE}"
|
||||
git clone "${DIR}"/.. "${REPO_CLONE}"
|
||||
mv "${REPO_CLONE}/gajim" "${PACKAGE_DIR}"
|
||||
|
||||
(cd "${REPO_CLONE}" && git checkout "$1") || exit 1
|
||||
|
||||
|
@ -186,6 +189,7 @@ function cleanup_install {
|
|||
-exec rm -f {} \;
|
||||
|
||||
rm -Rf "${REPO_CLONE}"/.git
|
||||
rm -Rf "${REPO_CLONE}"/.gitlab-ci.yml
|
||||
rm -Rf "${REPO_CLONE}"/debian
|
||||
rm -Rf "${REPO_CLONE}"/doc
|
||||
rm -Rf "${REPO_CLONE}"/m4
|
||||
|
@ -313,7 +317,7 @@ function cleanup_install {
|
|||
find "${MINGW_ROOT}"/bin -name "*.pyo" -exec rm -f {} \;
|
||||
find "${MINGW_ROOT}"/bin -name "*.pyc" -exec rm -f {} \;
|
||||
build_compileall -q "${MINGW_ROOT}"
|
||||
find "${MINGW_ROOT}" -name "*.py" ! -name "gajim.py" ! -name "history_manager.py" ! -name "*theme.py" -exec rm -f {} \;
|
||||
find "${MINGW_ROOT}" -name "*.py" ! -name "*theme.py" -exec rm -f {} \;
|
||||
find "${MINGW_ROOT}"/bin -name "*.pyc" -exec rm -f {} \;
|
||||
find "${MINGW_ROOT}" -type d -name "__pycache__" -prune -exec rm -rf {} \;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ def build_exe(source_path, resource_path, is_gui, out_path):
|
|||
subprocess.check_call(args)
|
||||
|
||||
|
||||
def get_launcher_code(entry_point):
|
||||
def get_launcher_code():
|
||||
template = """\
|
||||
#include "Python.h"
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
@ -87,19 +87,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
Py_FrozenFlag = 1;
|
||||
Py_Initialize();
|
||||
PySys_SetArgvEx(__argc, szArglist, 0);
|
||||
FILE* file = fopen("../gajim/gajim/%(filename)s", "r");
|
||||
PyRun_SimpleString("import sys; import os;"
|
||||
"os.chdir('../gajim/gajim');"
|
||||
"sys.path.append(os.getcwd());"
|
||||
"sys.frozen=True;"
|
||||
);
|
||||
result = PyRun_SimpleFile(file, "../gajim/gajim/%(filename)s");
|
||||
result = PyRun_SimpleString("import sys; import os;"
|
||||
"sys.frozen=True;"
|
||||
"os.chdir('../gajim');"
|
||||
"import gajim.gajim as g;"
|
||||
"g.GajimApplication().run(sys.argv);");
|
||||
Py_Finalize();
|
||||
return result;
|
||||
}
|
||||
"""
|
||||
|
||||
return template % {"filename": entry_point}
|
||||
return template
|
||||
|
||||
|
||||
def get_resouce_code(filename, file_version, file_desc, icon_path,
|
||||
|
@ -150,7 +148,7 @@ END
|
|||
|
||||
|
||||
def build_launcher(out_path, icon_path, file_desc, product_name, product_version,
|
||||
company_name, entry_point, is_gui):
|
||||
company_name, is_gui):
|
||||
|
||||
src_ico = os.path.abspath(icon_path)
|
||||
target = os.path.abspath(out_path)
|
||||
|
@ -162,7 +160,7 @@ def build_launcher(out_path, icon_path, file_desc, product_name, product_version
|
|||
try:
|
||||
os.chdir(temp)
|
||||
with open("launcher.c", "w") as h:
|
||||
h.write(get_launcher_code(entry_point))
|
||||
h.write(get_launcher_code())
|
||||
shutil.copyfile(src_ico, "launcher.ico")
|
||||
with open("launcher.rc", "w") as h:
|
||||
h.write(get_resouce_code(
|
||||
|
@ -188,17 +186,17 @@ def main():
|
|||
build_launcher(
|
||||
os.path.join(target, "Gajim.exe"),
|
||||
os.path.join(misc, "gajim.ico"), "Gajim", "Gajim",
|
||||
version, company_name, 'gajim.py', True)
|
||||
version, company_name, True)
|
||||
|
||||
build_launcher(
|
||||
os.path.join(target, "Gajim-Debug.exe"),
|
||||
os.path.join(misc, "gajim.ico"), "Gajim", "Gajim",
|
||||
version, company_name, 'gajim.py', False)
|
||||
version, company_name, False)
|
||||
|
||||
build_launcher(
|
||||
os.path.join(target, "history_manager.exe"),
|
||||
os.path.join(misc, "gajim.ico"), "History Manager", "History Manager",
|
||||
version, company_name, 'history_manager.py', True)
|
||||
# build_launcher(
|
||||
# os.path.join(target, "history_manager.exe"),
|
||||
# os.path.join(misc, "gajim.ico"), "History Manager", "History Manager",
|
||||
# version, company_name, 'history_manager.py', True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -105,9 +105,9 @@ Section "Gajim" SecGajim
|
|||
|
||||
SetOutPath "$INSTDIR\bin"
|
||||
CreateShortCut "$INSTDIR\Gajim-Portable.lnk" "$INSTDIR\bin\Gajim.exe" \
|
||||
"-c ..\..\UserData" "" "" SW_SHOWNORMAL "" "Gajim Portable"
|
||||
"-c ..\UserData" "" "" SW_SHOWNORMAL "" "Gajim Portable"
|
||||
CreateShortCut "$INSTDIR\Gajim-Portable-Debug.lnk" "$INSTDIR\bin\Gajim-Debug.exe" \
|
||||
"-c ..\..\UserData" "" "" SW_SHOWNORMAL "" "Gajim Portable Debug"
|
||||
"-c ..\UserData" "" "" SW_SHOWNORMAL "" "Gajim Portable Debug"
|
||||
|
||||
SectionEnd
|
||||
|
||||
|
|
Loading…
Reference in New Issue