diff --git a/.gitignore b/.gitignore index 906c067..20f4999 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ lib64/ parts/ sdist/ var/ +web-greeter/dist *.egg-info/ .installed.cfg *.egg diff --git a/Makefile b/Makefile index 9aa5bbe..b2aa12f 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,10 @@ build: _build_init _apply_config $(DO) build $(PREFIX) $(DO) prepare-install $(PREFIX) +build_old: _build_init _apply_config + $(DO) build_old $(PREFIX) + $(DO) prepare-install $(PREFIX) + build_dev: build $(call colorecho, Built for dev) @@ -75,5 +79,9 @@ install: build $(MAYBE_SUDO_DO) install $(DESTDIR) $(PREFIX) $(call colorecho, SUCCESS!) +install_old: build_old + $(MAYBE_SUDO_DO) install $(DESTDIR) $(PREFIX) + $(call colorecho, SUCCESS!) + .PHONY: all _apply_config _build_init build build_dev clean install diff --git a/README.md b/README.md index 30a28b5..99b21b4 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Install PIP dependencies with: pip install -r requirements.txt ``` -> ***NOTE*** Be sure to install pip libraries as root too +> ***NOTE*** Be sure to install pip libraries as root too, or use a venv to install these dependencies ## Download & Install ```sh @@ -51,6 +51,8 @@ sudo pip install -r requirements.txt sudo make install ``` +This will build and install **web-greeter** with [cx_freeze][cx_freeze]. Either `sudo make install_old`, which will use the old zippy way to install **web-greeter**; it's strongly recommended to not use the last one, as it depends on the actual python interpreter and its libraries. Update python or delete a library, and **web-greeter** won't work. + See [latest release][releases]. ## Theme JavaScript API @@ -86,6 +88,7 @@ web-greeter --debug [antergos]: https://github.com/Antergos "Antergos" [nody-greeter]: https://github.com/JezerM/nody-greeter "Nody Greeter" +[cx_freeze]: https://github.com/marcelotduarte/cx_Freeze "cx_Freeze" [acpilight]: https://gitlab.com/wavexx/acpilight "acpilight" [WebArchive]: https://web.archive.org/web/20190524032923/https://doclets.io/Antergos/web-greeter/stable "Web Archive" [gh-pages]: https://jezerm.github.io/web-greeter/ "API Documentation" diff --git a/build/utils.sh b/build/utils.sh index e6d4910..83c217e 100755 --- a/build/utils.sh +++ b/build/utils.sh @@ -18,13 +18,12 @@ combine_javascript_sources() { bootstrap.js > bundle.js } -do_build() { +do_old_build() { cd "${BUILD_DIR}" # Compile Resources (combine_javascript_sources \ - && pyrcc5 -o "${BUILD_DIR}/${PKGNAME}/resources.py" ../resources.qrc \ - && cp "${BUILD_DIR}/${PKGNAME}/resources.py" "${REPO_DIR}/web-greeter") + && pyrcc5 -o "${BUILD_DIR}/${PKGNAME}/resources.py" ../resources.qrc) # Create "Zip Application" (cd "${PKGNAME}" \ @@ -36,21 +35,29 @@ do_build() { && chmod +x "${INSTALL_ROOT}${PREFIX}/bin/web-greeter") } +do_build() { + cd "${BUILD_DIR}" + + echo "Building web-greeter with cx_freeze..." + python3 "${BUILD_DIR}/${PKGNAME}/setup.py" build >& setup_log + echo "setup.py log inside ${BUILD_DIR}/setup_log" + + mkdir -p "${INSTALL_ROOT}"/opt/web-greeter + mv "${BUILD_DIR}/${PKGNAME}"/dist/* "${INSTALL_ROOT}"/opt/web-greeter/ +} + do_install() { [[ -e "${DESTDIR}" ]] || mkdir -p "${DESTDIR}" cp -R "${INSTALL_ROOT}"/* "${DESTDIR}" -} - -# Not used -generate_pot_file() { - REPO_ROOT="$(dirname "${REPO_DIR}")" - xgettext --from-code UTF-8 -o "${REPO_ROOT}/po/web-greeter.pot" -d web-greeter "${REPO_ROOT}"/src/*.c + ln -sf "${DESTDIR}"/opt/web-greeter/web-greeter "${DESTDIR}"/usr/bin/web-greeter } init_build_dir() { [[ -e "${BUILD_DIR}/web-greeter" ]] && rm -rf "${BUILD_DIR}/web-greeter" [[ -e "${BUILD_DIR}/dist" ]] && rm -rf "${BUILD_DIR}/dist" - cp -R -t "${BUILD_DIR}" "${REPO_DIR}/web-greeter" "${REPO_DIR}/dist" + rsync -a "${REPO_DIR}/web-greeter" "${BUILD_DIR}" --exclude "dist" --exclude "__pycache__" + rsync -a "${REPO_DIR}/dist" "${BUILD_DIR}" + cp "${REPO_DIR}/README.md" "${BUILD_DIR}/web-greeter" } prepare_install() { @@ -68,8 +75,12 @@ prepare_install() { cp "${BUILD_DIR}/dist/${PKGNAME}.1" "${INSTALL_ROOT}${PREFIX}/share/man/man1" # Command line completions - cp "${BUILD_DIR}/dist/${PKGNAME}-bash" "${INSTALL_ROOT}${PREFIX}/share/bash-completion/completions/${PKGNAME}" - cp "${BUILD_DIR}/dist/${PKGNAME}-zsh" "${INSTALL_ROOT}${PREFIX}/share/zsh/vendor-completions/_${PKGNAME}" + if [[ -f /usr/bin/bash ]]; then + cp "${BUILD_DIR}/dist/${PKGNAME}-bash" "${INSTALL_ROOT}${PREFIX}/share/bash-completion/completions/${PKGNAME}" + fi + if [[ -f /usr/bin/zsh ]]; then + cp "${BUILD_DIR}/dist/${PKGNAME}-zsh" "${INSTALL_ROOT}${PREFIX}/share/zsh/vendor-completions/_${PKGNAME}" + fi # Greeter Config cp "${BUILD_DIR}/dist/${PKGNAME}.yml" "${INSTALL_ROOT}/etc/lightdm" @@ -131,6 +142,11 @@ case "$1" in do_build ;; + build_old) + PREFIX="$2" + do_old_build + ;; + build-init) init_build_dir ;; diff --git a/requirements.txt b/requirements.txt index 7b6762f..ad03dbf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ PyQt5 PyQtWebEngine ruamel.yaml python-xlib +cx_freeze diff --git a/web-greeter/setup.py b/web-greeter/setup.py new file mode 100644 index 0000000..e0afeba --- /dev/null +++ b/web-greeter/setup.py @@ -0,0 +1,28 @@ +from cx_Freeze import setup, Executable +import os + +setup_dir = os.path.abspath(os.path.dirname(__file__)) +os.chdir(setup_dir) + +long_description = "" + +if os.path.exists(os.path.join(setup_dir, "README.md")): + with open("README.md", "r", encoding="utf-8") as fh: + long_description = fh.read() + +setup( + name = "web-greeter", + version = "3.0.0", + license = 'GPL-3.0', + author = "Antergos Linux Project, Jezer Mejía", + author_email = "amyuki4@gmail.com", + description = "A modern, visually appealing greeter for LightDM", + long_description = long_description, + long_description_content_type="text/markdown", + executables = [Executable("__main__.py", target_name="web-greeter")], + options = {"build_exe": { + "build_exe": "dist", + "packages": ["gi", "Xlib"], + "silent_level": 0, + }}, + )