Skip to content

Commit

Permalink
Merge branch 'main' into fix-lp-2008237
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiusens authored Jul 7, 2023
2 parents 0372ec0 + 4d0d751 commit a488633
Show file tree
Hide file tree
Showing 36 changed files with 339 additions and 282 deletions.
31 changes: 31 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
---
# Required
version: 2

build:
os: ubuntu-20.04
tools:
python: "3.8"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
builder: html
fail_on_warning: true

# Build documentation with MkDocs
# mkdocs:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF
#formats:
# - pdf

# Optionally set the version of Python
# and requirements required to build your docs
python:
install:
- requirements: docs/.sphinx/requirements.txt
2 changes: 1 addition & 1 deletion docs/.sphinx/pinned-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pyenchant==3.2.2
Pygments==2.13.0
pyparsing==3.0.9
pytz==2022.6
requests==2.28.1
requests==2.31.0
six==1.16.0
snowballstemmer==2.2.0
soupsieve==2.3.2.post1
Expand Down
12 changes: 9 additions & 3 deletions extensions/desktop/common/desktop-exports
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash
###############################################
# Launcher common exports for any desktop app #
###############################################
###########################################################
# Launcher common exports for any desktop app
# This is not used with the gnome extension for
# core22 and later, please see
# https://github.com/snapcore/snapcraft-desktop-integration
###########################################################

# Note: We avoid using `eval` because we don't want to expand variable names
# in paths. For example: LD_LIBRARY_PATH paths might contain `$LIB`.
Expand Down Expand Up @@ -467,3 +470,6 @@ ln -sfn "$REALHOME/.config/ibus/bus" "$IBUS_CONFIG_PATH"

# Set libgweather path
export LIBGWEATHER_LOCATIONS_PATH="$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/libgweather-4/Locations.bin"

# Set libthai dict path
export LIBTHAI_DICTDIR="$SNAP_DESKTOP_RUNTIME/usr/share/libthai/"
6 changes: 6 additions & 0 deletions extensions/desktop/common/fonts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

###########################################################
# This is not used with the gnome extension for
# core22 and later, please see
# https://github.com/snapcore/snapcraft-desktop-integration
###########################################################

set -e

[ ! -d "${SNAP_COMMON}/fontconfig" ] && mkdir -p "${SNAP_COMMON}/fontconfig"
Expand Down
9 changes: 6 additions & 3 deletions extensions/desktop/common/init
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash
#################
# Launcher init #
#################
###########################################################
# Launcher init
# This is not used with the gnome extension for
# core22 and later, please see
# https://github.com/snapcore/snapcraft-desktop-integration
###########################################################

# shellcheck disable=SC2034
START=$(date +%s.%N)
Expand Down
9 changes: 6 additions & 3 deletions extensions/desktop/common/mark-and-exec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash
###############################
# Mark update and exec binary #
###############################
###########################################################
# Mark update and exec binary
# This is not used with the gnome extension for
# core22 and later, please see
# https://github.com/snapcore/snapcraft-desktop-integration
###########################################################

# shellcheck disable=SC2154
[ "$needs_update" = true ] && echo "SNAP_DESKTOP_LAST_REVISION=$SNAP_REVISION" > "$SNAP_USER_DATA/.last_revision"
Expand Down
9 changes: 6 additions & 3 deletions extensions/desktop/gnome/launcher-specific
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash
##############################
# GTK launcher specific part #
##############################
###########################################################
# GTK launcher specific part
# This is not used with the gnome extension for
# core22 and later, please see
# https://github.com/snapcore/snapcraft-desktop-integration
###########################################################

# shellcheck disable=SC2154
if [ "$wayland_available" = true ]; then
Expand Down
10 changes: 5 additions & 5 deletions requirements-devel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ codespell==2.2.4
colorama==0.4.6
coverage==7.2.5
craft-archives==1.0.0
craft-cli==1.2.0
craft-cli==2.0.0
craft-grammar==1.1.1
craft-parts==1.21.0
craft-parts==1.21.1
craft-providers==1.13.0
craft-store==2.4.0
cryptography==40.0.2
cryptography==41.0.0
Deprecated==1.2.13
dill==0.3.6
distlib==0.3.6
Expand Down Expand Up @@ -91,7 +91,7 @@ pytz==2023.3
pyxdg==0.28
PyYAML==6.0
raven==6.10.0
requests==2.30.0
requests==2.31.0
requests-toolbelt==1.0.0
requests-unixsocket==0.3.0
ruff==0.0.220
Expand Down Expand Up @@ -125,6 +125,6 @@ wrapt==1.15.0
ws4py==0.5.1
zope.deprecation==5.0
zope.interface==6.0
python-apt @ https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-apt/2.0.1ubuntu0.20.04.1/python-apt_2.0.1ubuntu0.20.04.1.tar.xz; sys.platform == "linux"
setuptools<66
python-apt @ https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-apt/2.4.0ubuntu1/python-apt_2.4.0ubuntu1.tar.xz; sys.platform == "linux"
pyinstaller==4.10; sys.platform == "win32"
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ chardet==5.1.0
charset-normalizer==3.1.0
click==8.1.3
craft-archives==1.0.0
craft-cli==1.2.0
craft-cli==2.0.0
craft-grammar==1.1.1
craft-parts==1.21.0
craft-parts==1.21.1
craft-providers==1.13.0
craft-store==2.4.0
cryptography==40.0.2
cryptography==41.0.0
Deprecated==1.2.13
distro==1.8.0
docutils==0.19
Expand Down Expand Up @@ -53,7 +53,7 @@ pytz==2023.3
pyxdg==0.28
PyYAML==6.0
raven==6.10.0
requests==2.30.0
requests==2.31.0
requests-toolbelt==1.0.0
requests-unixsocket==0.3.0
SecretStorage==3.3.3
Expand All @@ -71,4 +71,4 @@ wadllib==1.3.6
wrapt==1.15.0
ws4py==0.5.1
zipp==3.15.0
python-apt @ https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-apt/2.0.1ubuntu0.20.04.1/python-apt_2.0.1ubuntu0.20.04.1.tar.xz; sys.platform == "linux"
python-apt @ https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-apt/2.4.0ubuntu1/python-apt_2.4.0ubuntu1.tar.xz; sys.platform == "linux"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def recursive_data_files(directory, install_directory):
if ubuntu:
install_requires += [
"catkin-pkg",
"python-apt@https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-apt/2.0.0ubuntu0.20.04.6/python-apt_2.0.0ubuntu0.20.04.6.tar.xz",
"python-apt@https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-apt/2.4.0ubuntu1/python-apt_2.4.0ubuntu1.tar.xz",
"python-debian",
]

Expand Down
3 changes: 2 additions & 1 deletion snap/hooks/configure
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/snap/snapcraft/current/bin/python3

import sys

Expand All @@ -19,5 +19,6 @@ def validate_snap_config() -> None:
print(f"Could not configure snapcraft: {reason}.", file=sys.stderr)
sys.exit(1)


if __name__ == "__main__":
validate_snap_config()
110 changes: 64 additions & 46 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: snapcraft
base: core20
base: core22
summary: easily create snaps
description: |
Snapcraft aims to make upstream developers' lives easier and as such is not
Expand All @@ -12,16 +12,21 @@ license: GPL-3.0
assumes:
- snapd2.43

# https://github.com/snapcore/snapcraft/issues/4187
environment:
PATH: "$SNAP/libexec/snapcraft:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
LD_LIBRARY_PATH: "$SNAP/none"

apps:
snapcraft:
environment:
PATH: "$SNAP/libexec/snapcraft:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# https://github.com/lxc/pylxd/pull/361
PYLXD_WARNINGS: "none"
command: bin/python $SNAP/bin/snapcraft
completer: snapcraft-completion

build-packages:
- cargo
- build-essential
- intltool
- libapt-pkg-dev
Expand All @@ -35,22 +40,10 @@ build-packages:
- patch
- pkg-config
- python3-dev
- rustc
- sed

parts:
cryptography-deps:
# Rust build dependencies for Python cryptography library
plugin: nil
build-packages:
- cargo
- rustc
- curl
override-pull: |
# RISC-V doesn't have a new enough rust (>=1.48) on focal.
if [[ "${SNAPCRAFT_TARGET_ARCH}" = "riscv64" ]]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
fi
bash-completion:
source: debian
plugin: dump
Expand All @@ -64,19 +57,21 @@ parts:
source-branch: '0.9+snapcraft'
autotools-configure-parameters:
- --prefix=/
build-attributes:
- enable-patchelf
build-packages:
- g++
- git
- make
override-pull: |
snapcraftctl pull
${SNAP}/libexec/snapcraft/craftctl default
if [ "${SNAPCRAFT_TARGET_ARCH}" = "riscv64" ]; then
git am "${SNAPCRAFT_PROJECT_DIR}/snap/local/patches/patchelf/0001-Always-use-the-ET_DYN-codepath-avoiding-shifting-loa.patch"
git am "${SNAPCRAFT_PROJECT_DIR}/snap/local/patches/patchelf/0002-Fix-rewriteSectionsLibrary-to-not-assume-the-base-ad.patch"
if [ "${CRAFT_TARGET_ARCH}" = "riscv64" ]; then
git am "${CRAFT_PROJECT_DIR}/snap/local/patches/patchelf/0001-Always-use-the-ET_DYN-codepath-avoiding-shifting-loa.patch"
git am "${CRAFT_PROJECT_DIR}/snap/local/patches/patchelf/0002-Fix-rewriteSectionsLibrary-to-not-assume-the-base-ad.patch"
fi
override-build: |
snapcraftctl build
${SNAP}/libexec/snapcraft/craftctl default
make check
prime:
- bin/patchelf
Expand All @@ -96,64 +91,87 @@ parts:
- libxml2
- libxslt1.1
- libpython3-stdlib
- libpython3.8-stdlib
- libpython3.8-minimal
- libpython3.10-stdlib
- libpython3.10-minimal
- python3-pip
- python3-setuptools
- python3-wheel
- python3-venv
- python3-minimal
- python3-distutils
- python3-pkg-resources
- python3.8-minimal
- python3.10-minimal
- squashfs-tools
- xdelta3
build-attributes:
- enable-patchelf
override-build: |
snapcraftctl build
${SNAP}/libexec/snapcraft/craftctl default
echo "Create libsodium symlink..."
TRIPLET_PATH="$SNAPCRAFT_PART_INSTALL/usr/lib/$(gcc -print-multiarch)"
LIBSODIUM="$(readlink -n "$TRIPLET_PATH/libsodium.so.23")"
# Remove so the link can be recreated on re-builds
rm -f "$TRIPLET_PATH/libsodium.so"
ln -s "$LIBSODIUM" "$TRIPLET_PATH/libsodium.so"
$SNAPCRAFT_PROJECT_DIR/tools/snapcraft-override-build.sh
# Restore patched files
PYTHON_PACKAGE_PATH="${SNAPCRAFT_PART_INSTALL}/usr/lib/python3.10/"
CTYPES_INIT="ctypes/__init__.py"
CTYPES_INIT_ORIG="patched/${CTYPES_INIT}.orig"
[ -f "${CTYPES_INIT_ORIG}" ] && mv "${CTYPES_INIT_ORIG}" "${PYTHON_PACKAGE_PATH}/${CTYPES_INIT}"
# Apply patches
echo "Patching ctypes..."
patch -s -b "${PYTHON_PACKAGE_PATH}/${CTYPES_INIT}" "${SNAPCRAFT_PROJECT_DIR}/patches/ctypes_init.diff"
# Save patches to allow rebuilding
mkdir -p patched/ctypes
if [ -f "${PYTHON_PACKAGE_PATH}/${CTYPES_INIT}.orig" ]; then
mv "${PYTHON_PACKAGE_PATH}/${CTYPES_INIT}.orig" patched/ctypes
fi
# Disable site packages
sed -i "${SNAPCRAFT_PART_INSTALL}/usr/lib/python3.10/site.py" \
-e 's/^ENABLE_USER_SITE = None$/ENABLE_USER_SITE = False/'
snapcraft:
source: .
plugin: python
python-packages:
- wheel
- pip
- setuptools<66 # Limited to < 66 because we need `pkg_resources` and because `python-apt` doesn't build with the latest.
requirements:
# Limited to < 66 because we need `pkg_resources` and because `python-apt`
# does not build with the latest.
- setuptools<66
python-requirements:
- requirements.txt
organize:
# Put snapcraftctl into its own directory that can be included in the PATH
# Put snapcraftctl and craftctl into its own directory that can be included in the PATH
# without including other binaries.
bin/craftctl: libexec/snapcraft/craftctl
bin/snapcraftctl: bin/scriptlet-bin/snapcraftctl
# Also install the compatibility wrapper for core22+
# Also install the compatibility wrapper for core22+.
bin/snapcraftctl-compat: libexec/snapcraft/snapcraftctl
build-attributes:
- enable-patchelf
build-environment:
- "PIP_NO_BINARY": "PyNaCl" # Build PyNaCl from source since the wheel files interact strangely with classic snaps.
- "SODIUM_INSTALL": "system" # Use base image's libsodium for PyNaCl
- "CFLAGS": "$(pkg-config python-3.8 yaml-0.1 --cflags)"
- "PATH": "${HOME}/.cargo/bin:${PATH}"
# Build PyNaCl from source since the wheel files interact
# strangely with classic snaps.
- "PIP_NO_BINARY": "PyNaCl"
# Use base image's libsodium for PyNaCl.
- "SODIUM_INSTALL": "system"
- "CFLAGS": "$(pkg-config python-3.10 yaml-0.1 --cflags)"
override-build: |
snapcraftctl build
${SNAP}/libexec/snapcraft/craftctl default
version="$(python3 setup.py --version)"
snapcraftctl set-version "$version"
${SNAP}/libexec/snapcraft/craftctl set version="$version"
[ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable
snapcraftctl set-grade "$grade"
ln -sf ../usr/bin/python3.8 $SNAPCRAFT_PART_INSTALL/bin/python3
mkdir -p $SNAPCRAFT_PART_INSTALL/libexec/snapcraft
mv $SNAPCRAFT_PART_INSTALL/bin/craftctl $SNAPCRAFT_PART_INSTALL/libexec/snapcraft/
sed -i -e '1 s|^#!/.*|#!/snap/snapcraft/current/bin/python -E|' $SNAPCRAFT_PART_INSTALL/libexec/snapcraft/craftctl
after: [snapcraft-libs, cryptography-deps]

hooks:
configure:
environment:
PATH: "$SNAP/bin"
sed -i -e '1 s|^#!/.*|#!/snap/snapcraft/current/bin/python -E|' $SNAPCRAFT_PART_INSTALL/bin/craftctl
${SNAP}/libexec/snapcraft/craftctl set grade="$grade"
# The new implementation still requires this.
ln -sf ../usr/bin/python3.10 $SNAPCRAFT_PART_INSTALL/bin/python3
after: [snapcraft-libs]
Loading

0 comments on commit a488633

Please sign in to comment.