mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-25 02:32:58 -03:00
Snapcraft: New strategy for snap
This commit is contained in:
parent
1d59695189
commit
3ac2053804
3 changed files with 27 additions and 31 deletions
|
@ -10,7 +10,6 @@ python = ">=3.7,<3.11"
|
||||||
onionshare_cli = {path = "../cli", develop = true}
|
onionshare_cli = {path = "../cli", develop = true}
|
||||||
PySide2 = "5.15.2.1"
|
PySide2 = "5.15.2.1"
|
||||||
qrcode = "*"
|
qrcode = "*"
|
||||||
cx_freeze = "*"
|
|
||||||
werkzeug = "~2.0.3"
|
werkzeug = "~2.0.3"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
|
@ -19,6 +18,7 @@ black = "*"
|
||||||
pytest = "*"
|
pytest = "*"
|
||||||
pytest-faulthandler = "*"
|
pytest-faulthandler = "*"
|
||||||
pytest-qt = "*"
|
pytest-qt = "*"
|
||||||
|
cx_freeze = "*"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
|
|
@ -47,6 +47,7 @@ setuptools.setup(
|
||||||
entry_points={
|
entry_points={
|
||||||
"console_scripts": [
|
"console_scripts": [
|
||||||
"onionshare = onionshare:main",
|
"onionshare = onionshare:main",
|
||||||
|
"onionshare-cli = onionshare_cli:main",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -42,16 +42,13 @@ apps:
|
||||||
LANG: C.UTF-8
|
LANG: C.UTF-8
|
||||||
|
|
||||||
parts:
|
parts:
|
||||||
# Launcher scripts, in order to set PYTHONPATH
|
|
||||||
launcher:
|
launcher:
|
||||||
plugin: nil
|
plugin: nil
|
||||||
override-build: |
|
override-build: |
|
||||||
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
|
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
|
||||||
|
|
||||||
cat > $SNAPCRAFT_PART_INSTALL/bin/launcher-setup << EOF
|
cat > $SNAPCRAFT_PART_INSTALL/bin/launcher-setup << EOF
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
export PATH=\$SNAP/bin:\$SNAP/usr/bin:\$SNAP/usr/local/bin:\$PATH
|
export PATH=\$SNAP/bin:\$SNAP/usr/bin:\$SNAP/usr/local/bin:\$PATH
|
||||||
export PYTHONPATH=\$SNAP/lib/python3.8/site-packages:\$SNAP/usr/lib/python3/dist-packages
|
|
||||||
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$SNAP/usr/local/lib
|
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$SNAP/usr/local/lib
|
||||||
ORIG_IFS=\$IFS
|
ORIG_IFS=\$IFS
|
||||||
IFS=":"
|
IFS=":"
|
||||||
|
@ -59,25 +56,36 @@ parts:
|
||||||
IFS=\$ORIGIN_IFS
|
IFS=\$ORIGIN_IFS
|
||||||
export QT_PLUGIN_PATH=\$LIB_BASE/qt5/plugins
|
export QT_PLUGIN_PATH=\$LIB_BASE/qt5/plugins
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher << EOF
|
cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher << EOF
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. \$SNAP/bin/launcher-setup
|
. \$SNAP/bin/launcher-setup
|
||||||
onionshare \$@
|
onionshare \$@
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher << EOF
|
cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher << EOF
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. \$SNAP/bin/launcher-setup
|
. \$SNAP/bin/launcher-setup
|
||||||
onionshare-cli \$@
|
onionshare-cli \$@
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/launcher-setup
|
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/launcher-setup
|
||||||
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher
|
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher
|
||||||
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher
|
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher
|
||||||
|
|
||||||
|
onionshare-cli:
|
||||||
|
source: ./cli
|
||||||
|
plugin: nil
|
||||||
|
after: [tor, obfs4, snowflake-client, meek-client]
|
||||||
|
|
||||||
onionshare:
|
onionshare:
|
||||||
source: ./desktop
|
source: ./desktop
|
||||||
plugin: python
|
plugin: python
|
||||||
|
build-packages:
|
||||||
|
- build-essential
|
||||||
|
- libssl-dev
|
||||||
|
- libffi-dev
|
||||||
|
- python3-dev
|
||||||
|
- python3-pip
|
||||||
|
- rustc
|
||||||
|
- cargo
|
||||||
build-environment:
|
build-environment:
|
||||||
- PATH: /usr/bin:$PATH
|
- PATH: /usr/bin:$PATH
|
||||||
- PYTHONPATH: ""
|
- PYTHONPATH: ""
|
||||||
|
@ -145,33 +153,20 @@ parts:
|
||||||
- python3-pyside2.qtcore
|
- python3-pyside2.qtcore
|
||||||
- python3-pyside2.qtgui
|
- python3-pyside2.qtgui
|
||||||
- python3-pyside2.qtwidgets
|
- python3-pyside2.qtwidgets
|
||||||
|
override-pull: |
|
||||||
|
snapcraftctl pull
|
||||||
|
sed -i 's|path = "../cli", develop = true|path = "'$(pwd)'/../../onionshare-cli/src"|g' pyproject.toml
|
||||||
|
sed -i 's|PySide2|# PySide2|g' pyproject.toml
|
||||||
override-build: |
|
override-build: |
|
||||||
python3 -m pip install qrcode --prefix $SNAPCRAFT_PART_INSTALL
|
python3 -m venv $SNAPCRAFT_PART_INSTALL
|
||||||
python3 setup.py install --prefix $SNAPCRAFT_PART_INSTALL
|
. $SNAPCRAFT_PART_INSTALL/bin/activate
|
||||||
|
pip install -U pip setuptools wheel
|
||||||
|
pip install -U .
|
||||||
|
deactivate
|
||||||
|
sed -i 's|'$SNAPCRAFT_PART_INSTALL'/bin/python3|/usr/bin/env python3|g' $SNAPCRAFT_PART_INSTALL/bin/onionshare
|
||||||
|
sed -i 's|'$SNAPCRAFT_PART_INSTALL'/bin/python3|/usr/bin/env python3|g' $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli
|
||||||
after: [onionshare-cli]
|
after: [onionshare-cli]
|
||||||
|
|
||||||
onionshare-cli:
|
|
||||||
source: ./cli
|
|
||||||
plugin: python
|
|
||||||
build-environment:
|
|
||||||
- PATH: /usr/bin:$PATH
|
|
||||||
- PYTHONPATH: ""
|
|
||||||
build-packages:
|
|
||||||
- build-essential
|
|
||||||
- libssl-dev
|
|
||||||
- libffi-dev
|
|
||||||
- python3-dev
|
|
||||||
- python3-pip
|
|
||||||
- rustc
|
|
||||||
- cargo
|
|
||||||
override-build: |
|
|
||||||
python3 -m pip install poetry
|
|
||||||
python3 -m pip install setuptools
|
|
||||||
python3 -m poetry install
|
|
||||||
python3 -m poetry build
|
|
||||||
python3 -m pip install $SNAPCRAFT_PART_BUILD/dist/onionshare_cli-*.whl --prefix $SNAPCRAFT_PART_INSTALL
|
|
||||||
after: [tor, obfs4, snowflake-client, meek-client]
|
|
||||||
|
|
||||||
tor:
|
tor:
|
||||||
source: https://dist.torproject.org/tor-0.4.7.9.tar.gz
|
source: https://dist.torproject.org/tor-0.4.7.9.tar.gz
|
||||||
source-checksum: sha256/d39d38598208f4d6201d7edc6ad573b3a898a932a5c68d3074016a9525519b22
|
source-checksum: sha256/d39d38598208f4d6201d7edc6ad573b3a898a932a5c68d3074016a9525519b22
|
||||||
|
|
Loading…
Add table
Reference in a new issue