Browse Source

Updated build system

sisyphus
JezerM 3 years ago
parent
commit
70b19cba42
No known key found for this signature in database
GPG Key ID: 66BBC5D01388C6B5
  1. 1
      .gitignore
  2. 8
      Makefile
  3. 5
      README.md
  4. 36
      build/utils.sh
  5. 1
      requirements.txt
  6. 28
      web-greeter/setup.py

1
.gitignore vendored

@ -30,6 +30,7 @@ lib64/
parts/
sdist/
var/
web-greeter/dist
*.egg-info/
.installed.cfg
*.egg

8
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

5
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"

36
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
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
;;

1
requirements.txt

@ -3,3 +3,4 @@ PyQt5
PyQtWebEngine
ruamel.yaml
python-xlib
cx_freeze

28
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,
}},
)
Loading…
Cancel
Save