diff --git a/desktop/pyproject.toml b/desktop/pyproject.toml index a55a2003..bb4ae5f6 100644 --- a/desktop/pyproject.toml +++ b/desktop/pyproject.toml @@ -10,7 +10,6 @@ python = ">=3.7,<3.11" onionshare_cli = {path = "../cli", develop = true} PySide2 = "5.15.2.1" qrcode = "*" -cx_freeze = "*" werkzeug = "~2.0.3" [tool.poetry.dev-dependencies] @@ -19,6 +18,7 @@ black = "*" pytest = "*" pytest-faulthandler = "*" pytest-qt = "*" +cx_freeze = "*" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/desktop/setup.py b/desktop/setup.py index ba3b46d5..12a6cda4 100644 --- a/desktop/setup.py +++ b/desktop/setup.py @@ -47,6 +47,7 @@ setuptools.setup( entry_points={ "console_scripts": [ "onionshare = onionshare:main", + "onionshare-cli = onionshare_cli:main", ], }, ) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d24ccbfc..c8eb70b3 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -42,16 +42,13 @@ apps: LANG: C.UTF-8 parts: - # Launcher scripts, in order to set PYTHONPATH launcher: plugin: nil override-build: | mkdir -p $SNAPCRAFT_PART_INSTALL/bin - cat > $SNAPCRAFT_PART_INSTALL/bin/launcher-setup << EOF #!/bin/sh 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 ORIG_IFS=\$IFS IFS=":" @@ -59,25 +56,36 @@ parts: IFS=\$ORIGIN_IFS export QT_PLUGIN_PATH=\$LIB_BASE/qt5/plugins EOF - cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher << EOF #!/bin/sh . \$SNAP/bin/launcher-setup onionshare \$@ EOF - cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher << EOF #!/bin/sh . \$SNAP/bin/launcher-setup onionshare-cli \$@ EOF - chmod 755 $SNAPCRAFT_PART_INSTALL/bin/launcher-setup chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher + + onionshare-cli: + source: ./cli + plugin: nil + after: [tor, obfs4, snowflake-client, meek-client] + onionshare: source: ./desktop plugin: python + build-packages: + - build-essential + - libssl-dev + - libffi-dev + - python3-dev + - python3-pip + - rustc + - cargo build-environment: - PATH: /usr/bin:$PATH - PYTHONPATH: "" @@ -145,33 +153,20 @@ parts: - python3-pyside2.qtcore - python3-pyside2.qtgui - 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: | - python3 -m pip install qrcode --prefix $SNAPCRAFT_PART_INSTALL - python3 setup.py install --prefix $SNAPCRAFT_PART_INSTALL + python3 -m venv $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] - 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: source: https://dist.torproject.org/tor-0.4.7.9.tar.gz source-checksum: sha256/d39d38598208f4d6201d7edc6ad573b3a898a932a5c68d3074016a9525519b22