Skip to content

Commit

Permalink
cicd: appimage no longer requires libcrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
dynobo committed Nov 16, 2024
1 parent e8f33a1 commit b35c312
Show file tree
Hide file tree
Showing 11 changed files with 228 additions and 149 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# Changelog

## v0.6.0 (upcoming)

- Linux: AppImage no longer requires `libcrypt`.

## v0.5.9 (2024-11-10)

- All: Add Chinese translation. Thanks, [@mofazhe](https://github.com/mofazhe)! ([#661](https://github.com/dynobo/normcap/pull/661))
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ take a look at the [FAQs](https://dynobo.github.io/normcap/#faqs) or

#### Linux
- [NormCap-0.5.9-x86_64.AppImage](https://github.com/dynobo/normcap/releases/download/v0.5.9/NormCap-0.5.9-x86_64.AppImage)
(Binary, requires [fuse](https://dynobo.github.io/normcap/faqs/#linux-appimage-error-appimages-require-fuse-to-run) & [libcrypt](https://dynobo.github.io/normcap/faqs/#linux-appimage-error-while-loading-shared-libraries-libcryptso1))

TODO: Verify that AppImage does not require libcrypt anymore. Then remove from FAQ and here.

(Binary, requires [fuse](https://dynobo.github.io/normcap/faqs/#linux-appimage-error-appimages-require-fuse-to-run))
- [com.github.dynobo.normcap @ FlatHub](https://flathub.org/apps/details/com.github.dynobo.normcap)
(FlatPak)
- [`normcap` @ AUR](https://aur.archlinux.org/packages/normcap) (Arch/Manjaro)
Expand Down
2 changes: 1 addition & 1 deletion bundle/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def install_deps(system: System) -> None:
run("sudo add-apt-repository -y universe")
run("sudo apt install -y libfuse2 libxcb1 libxcb-cursor0")
if system == System.MANJARO_XORG:
run("sudo pacman -Sy --noconfirm libxcb xcb-util-cursor libxcrypt-compat")
run("sudo pacman -Sy --noconfirm libxcb xcb-util-cursor")
if system == System.FEDORA_XORG:
run("sudo dnf install -y libxcb xcb-util-cursor")

Expand Down
7 changes: 3 additions & 4 deletions bundle/platforms/linux_briefcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ def _patch_briefcase_appimage_to_include_deps(self) -> None:
"""
self.patch_file(file_path=file_path, insert_after=insert_after, patch=patch)

def _patch_briefcase_appimage_to_run_cmd(self) -> None:
"""Execute _before_ linuxdeploy."""
# TODO: check if still necessary
def _patch_briefcase_appimage_to_print_envars(self) -> None:
"""For debugging. Execute _before_ linuxdeploy."""
file_path = (
Path(briefcase.__file__).parent / "platforms" / "linux" / "appimage.py"
)
Expand Down Expand Up @@ -83,5 +82,5 @@ def bundle_tesseract(self) -> None: ...
def install_system_deps(self) -> None: ...

def pre_framework(self) -> None:
self._patch_briefcase_appimage_to_run_cmd()
self._patch_briefcase_appimage_to_print_envars()
self._patch_briefcase_appimage_to_include_deps()
1 change: 0 additions & 1 deletion bundle/platforms/macos_briefcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def _patch_info_plist_for_proper_fullscreen(self) -> None:
See details:
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/20001431-113616
"""
# TODO: Replace by briefcase config
file_path = Path("macOS/app/NormCap/NormCap.app/Contents") / "Info.plist"
patch = """
<key>LSUIPresentationMode</key>
Expand Down
2 changes: 1 addition & 1 deletion bundle/platforms/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def get_version(self) -> str:

with Path(self.PYPROJECT_PATH).open(encoding="utf8") as toml_file:
pyproject_toml = toml.load(toml_file)
return pyproject_toml["tool"]["briefcase"]["version"]
return pyproject_toml["project"]["version"]

@staticmethod
def run(cmd: Union[str, list], cwd: Optional[Path] = None) -> Optional[str]:
Expand Down
1 change: 0 additions & 1 deletion bundle/platforms/windows_briefcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def _download_openssl(self) -> None:
# For mirrors see: https://wiki.openssl.org/index.php/Binaries
# openssl_url = "http://mirror.firedaemon.com/OpenSSL/openssl-1.1.1q.zip"
# openssl_url = "http://wiki.overbyte.eu/arch/openssl-1.1.1q-win64.zip"
# TODO: Update openssl
openssl_url = "https://indy.fulgan.com/SSL/openssl-1.0.2u-x64_86-win64.zip"
target_path = self.PROJECT_PATH / "normcap" / "resources" / "openssl"
target_path.mkdir(exist_ok=True)
Expand Down
15 changes: 0 additions & 15 deletions docs/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,21 +370,6 @@ See

</details>

<details class="question" markdown>
<summary>[Linux, AppImage] Error while loading shared libraries: libcrypt.so.1</summary>

### \[Linux, AppImage\] Error while loading shared libraries: libcrypt.so.1

The
[application used to package the AppImage](https://gregoryszorc.com/docs/python-build-standalone/main/running.html#runtime-requirements)
has a number of runtime requirements. One of those requirements is `libcrypt.so.1`,
which should be provided by most modern Linux distributions, as it is mandated as part
of the Linux Standard Base Core Specification. However, some distributions don't include
`libcrypt.so.1` as part of the base OS configuration. This can usually be fixed by
installing the `libxcrypt-compat` package.

</details>

<details class="question" markdown>
<summary>[macOS] When NormCap is started, an empty desktop shows up</summary>

Expand Down
171 changes: 73 additions & 98 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[build-system]
requires = ["hatchling"]
requires = [ "hatchling" ]
build-backend = "hatchling.build"

[project]
name = "normcap"
version = "0.5.9"
description = "OCR-powered screen-capture tool to capture information instead of images."
keywords = ["screenshot", "ocr", "capture", "clipboard"]
keywords = [ "screenshot", "ocr", "capture", "clipboard" ]
readme = "README.md"
requires-python = ">=3.9,<=3.12"
license = "GPL-3.0-or-later"
authors = [{ name = "dynobo", email = "[email protected]" }]
requires-python = ">=3.9"
license.file = "LICENSE"
authors = [ { name = "dynobo", email = "[email protected]" } ]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
Expand All @@ -34,7 +34,7 @@ dependencies = [
]

[project.optional-dependencies]
build = ["babel", "toml"]
build = [ "babel", "toml" ]

[project.urls]
Homepage = "https://dynobo.github.io/normcap/"
Expand All @@ -47,8 +47,8 @@ Changelog = "https://github.com/dynobo/normcap/blob/main/CHANGELOG"
normcap = "normcap.app:run"

[tool.hatch.build]
exclude = ["assets", "*.po"]
artifacts = ["*.mo"]
exclude = [ "assets", "*.po" ]
artifacts = [ "*.mo" ]

[dependency-groups]
dev = [
Expand Down Expand Up @@ -81,7 +81,7 @@ dev = [
"typing-extensions>=4.4.0",
"poethepoet>=0.29.0",
]
analysis = ["radon>=5.1.0", "viztracer>=0.15.3", "vulture>=2.4"]
analysis = [ "radon>=5.1.0", "viztracer>=0.15.3", "vulture>=2.4" ]

[tool.poe.tasks]

Expand All @@ -96,50 +96,31 @@ version = "tbump"
docs-serve = "mkdocs serve"
docs-build = "mkdocs build"

test = [
{ cmd = "pytest" },
{ cmd = "coverage lcov" },
]
quick-test = [
{ cmd = "pytest -m 'not gui'" },
{ cmd = "coverage lcov" },
]
test = [ { cmd = "pytest" }, { cmd = "coverage lcov" } ]
quick-test = [ { cmd = "pytest -m 'not gui'" }, { cmd = "coverage lcov" } ]
check = [
{ cmd = "ruff check" },
{ cmd = "ruff format --check --diff" },
{ cmd = "mdformat --align-semantic-breaks-in-lists --end-of-line keep" },
{ cmd = "mypy" },
{ cmd = "ruff check" },
{ cmd = "ruff format --check --diff" },
{ cmd = "mdformat --align-semantic-breaks-in-lists --end-of-line keep" },
{ cmd = "mypy" },
]
format = [
{ cmd = "ruff check --fix-only" },
{ cmd = "ruff format" },
{ ref = "locales-compile"},
{ cmd = "mdformat --align-semantic-breaks-in-lists --end-of-line keep" },
{ cmd = "ruff check --fix-only" },
{ cmd = "ruff format" },
{ ref = "locales-compile" },
{ cmd = "mdformat --align-semantic-breaks-in-lists --end-of-line keep" },
]
chart = [
{ cmd = "pydeps normcap --max-bacon=2 -o=pydeps.png -T=png" },
{ cmd = "pydeps normcap --max-bacon=1 -o=pydeps_internal.png -T=png" },
]
bundle = [
{ ref = "locales-compile" },
{ cmd = "python bundle/build.py" },
{ cmd = "pydeps normcap --max-bacon=2 -o=pydeps.png -T=png" },
{ cmd = "pydeps normcap --max-bacon=1 -o=pydeps_internal.png -T=png" },
]
bundle = [ { ref = "locales-compile" }, { cmd = "python bundle/build.py" } ]
bundle-dev = [
{ ref = "locales-compile" },
{ cmd = "python bundle/build.py --dev" },
]
pre-commit = [
"format",
"check",
"quick-test",
"chart"
]
cicd-check = [
"format",
"check",
"security",
"test",
{ ref = "locales-compile" },
{ cmd = "python bundle/build.py --dev" },
]
pre-commit = [ "format", "check", "quick-test", "chart" ]
cicd-check = [ "format", "check", "security", "test" ]

inspect-trace = "viztracer --open --log_gc --ignore_c_function -- normcap/app.py"
inspect-trace-view = "vizviewer {args:result.json}"
Expand All @@ -156,70 +137,70 @@ inspect_metrics = [
[tool.ruff]
target-version = "py39"
line-length = 88
exclude = [".venv"]
exclude = [ ".venv" ]

[tool.ruff.lint]
select = [
"F", # Pyflakes
"E", # pycodestyle
"I", # Isort
"D", # pydocstyle
"W", # warning
"UP", # pyupgrad
"N", # pep8-naming
"C90", # mccabe
"TRY", # tryceratops (exception handling)
"ANN", # flake8-annotations
"S", # flake8-bandits
"C4", # flake8-comprehensions
"B", # flake8-bugbear
"A", # flake8-builtins
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RET", # flake8-return
"SIM", # flake8-simplify
"PTH", # flake8-use-pathlib
"G", # flake8-logging-format
"PL", # pylint
"RUF", # meta rules (unused noqa)
"PL", # meta rules (unused noqa)
"F", # Pyflakes
"E", # pycodestyle
"I", # Isort
"D", # pydocstyle
"W", # warning
"UP", # pyupgrad
"N", # pep8-naming
"C90", # mccabe
"TRY", # tryceratops (exception handling)
"ANN", # flake8-annotations
"S", # flake8-bandits
"C4", # flake8-comprehensions
"B", # flake8-bugbear
"A", # flake8-builtins
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RET", # flake8-return
"SIM", # flake8-simplify
"PTH", # flake8-use-pathlib
"G", # flake8-logging-format
"PL", # pylint
"RUF", # meta rules (unused noqa)
"PL", # meta rules (unused noqa)
"PERF", # perflint
]
ignore = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D107", # Missing docstring in __init__
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D107", # Missing docstring in __init__
"ANN101", # Missing type annotation for `self` in method
"TRY003", # Avoid specifying long messages outside the exception class
"ISC001", # Rule conflicts with ruff's formatter
]

[tool.ruff.lint.per-file-ignores]
"tests/**/*" = ["PLR2004", "PLR0913", "S101", "TID252", "ANN", "D"]
"tests/**/*" = [ "PLR2004", "PLR0913", "S101", "TID252", "ANN", "D" ]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.isort]
known-first-party = ["normcap"]
known-first-party = [ "normcap" ]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.mypy]
files = ["normcap/**/*.py", "tests/**/*.py", "bundle/**/*.py"]
files = [ "normcap/**/*.py", "tests/**/*.py", "bundle/**/*.py" ]
follow_imports = "skip"
ignore_missing_imports = true

[tool.pytest.ini_options]
testpaths = ["tests"]
testpaths = [ "tests" ]
qt_api = "pyside6"
xvfb_width = 1920
xvfb_height = 1080
Expand All @@ -232,13 +213,13 @@ addopts = [
"--cov-report=xml",
"--cov-report=html",
]
markers = ["gui: tests which require a graphical interface to run"]
markers = [ "gui: tests which require a graphical interface to run" ]

[tool.coverage.run]
source = ["normcap"]
source = [ "normcap" ]
branch = true
parallel = true
omit = []
omit = [ ]

[tool.mdformat]
wrap = 88
Expand All @@ -258,7 +239,7 @@ bundle = "eu.dynobo"

[tool.briefcase.app.normcap]
formal_name = "NormCap"
sources = ["normcap"]
sources = [ "normcap" ]
icon = "bundle/imgs/normcap"
installer_icon = "bundle/imgs/normcap_install"
installer_background = "bundle/imgs/normcap_install_bg"
Expand Down Expand Up @@ -307,16 +288,12 @@ cleanup_paths = [
]

[tool.briefcase.app.normcap.macOS.Xcode]
requires = ["std-nslog==1.0.0"]
universal_build = true
# TODO: Configure Entitlements.plist ? For screenshot and notify permissions?
# TODO: Info.plist?
# TODO: Remove build for x64 (not needed anymore). Also from docs.

requires = [ "std-nslog==1.0.0" ]
universal_build = false

[tool.briefcase.app.normcap.linux.appimage]
template = "https://github.com/beeware/briefcase-linux-appimage-template"
template_branch = "v0.3.16"
template_branch = "v0.3.20"
manylinux = "manylinux_2_28"
manylinux_image_tag = "latest"
system_requires = [
Expand All @@ -329,7 +306,7 @@ system_requires = [
# xcb-utils-cursor deps
"libxcb-devel",
"libxkbcommon-x11",
"epel-release", # for xcb-util-cursor
"epel-release", # for xcb-util-cursor
]

dockerfile_extra_content = """
Expand Down Expand Up @@ -358,13 +335,11 @@ RUN cd wl-clipboard \
&& ninja \
&& meson install
ENV LD_LIBRARY_PATH "$LD_LIBRARY_PATH:/app/NormCap.AppDir/usr/app_packages/shiboken6"
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/app/NormCap.AppDir/usr/app_packages/shiboken6"
USER brutus
"""

# TODO: Use briefcase --Xdocker-build for docker build args (if applicable)

[tool.briefcase.app.normcap.windows]
use_full_install_path = false

Expand Down
Loading

0 comments on commit b35c312

Please sign in to comment.