From f22958cbae5d8434a75715f7e99b7aa47416deba Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Wed, 6 May 2020 16:05:48 -0700 Subject: [PATCH] Successfully install Qt5, attempt to get onionshare python deps installed --- poetry.lock | 57 +++++---------------------- pyproject.toml | 12 ------ setup.py | 2 +- snap/qt-installer-script.js | 78 +++++++++++++++++++++++++++++++++++++ snap/snapcraft.yaml | 64 +++++++++++++++++++++++++++--- 5 files changed, 146 insertions(+), 67 deletions(-) create mode 100644 snap/qt-installer-script.js diff --git a/poetry.lock b/poetry.lock index 8f65a9be..723dee80 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,6 +1,7 @@ [[package]] -category = "main" +category = "dev" description = "Python graph (network) package" +marker = "sys_platform == \"darwin\"" name = "altgraph" optional = false python-versions = "*" @@ -100,14 +101,6 @@ version = "4.0.0" [package.dependencies] Flask = "*" -[[package]] -category = "main" -description = "Clean single-source support for Python 3 and 2" -name = "future" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -version = "0.18.2" - [[package]] category = "main" description = "Internationalized Domain Names in Applications (IDNA)" @@ -154,17 +147,6 @@ MarkupSafe = ">=0.23" [package.extras] i18n = ["Babel (>=0.8)"] -[[package]] -category = "main" -description = "Mach-O header analysis and editing" -name = "macholib" -optional = false -python-versions = "*" -version = "1.14" - -[package.dependencies] -altgraph = ">=0.15" - [[package]] category = "main" description = "Safely add untrusted strings to HTML/XML markup." @@ -193,17 +175,6 @@ version = "20.3" pyparsing = ">=2.0.2" six = "*" -[[package]] -category = "main" -description = "Python PE parsing module" -name = "pefile" -optional = false -python-versions = "*" -version = "2019.4.18" - -[package.dependencies] -future = "*" - [[package]] category = "dev" description = "plugin and hook calling mechanisms for python" @@ -264,7 +235,7 @@ description = "Python bindings for the Qt cross platform application toolkit" name = "pyqt5" optional = false python-versions = ">=3.5" -version = "5.14.2" +version = "5.14.0" [package.dependencies] PyQt5-sip = ">=12.7,<13" @@ -418,7 +389,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "8b05e3708399e2fd51876b0ac9468805989195fc7d322cf0cf6973ec5de49ac8" +content-hash = "be6f59a8ce3099b4205ba5d024284a380912f2caa2bba7765a73b5eddfc7a816" python-versions = "^3.6" [metadata.files] @@ -463,9 +434,6 @@ flask-httpauth = [ {file = "Flask-HTTPAuth-4.0.0.tar.gz", hash = "sha256:47d62edc33ff16798ed28e06a7387ed10a15f21249c5f61515b41351356a6afc"}, {file = "Flask_HTTPAuth-4.0.0-py2.py3-none-any.whl", hash = "sha256:067768dbed7b68b2a0172453eaad64648cd6b004b8a2a3912f363050532d11c3"}, ] -future = [ - {file = "future-0.18.2.tar.gz", hash = "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"}, -] idna = [ {file = "idna-2.9-py2.py3-none-any.whl", hash = "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"}, {file = "idna-2.9.tar.gz", hash = "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb"}, @@ -482,10 +450,6 @@ jinja2 = [ {file = "Jinja2-2.11.2-py2.py3-none-any.whl", hash = "sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035"}, {file = "Jinja2-2.11.2.tar.gz", hash = "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0"}, ] -macholib = [ - {file = "macholib-1.14-py2.py3-none-any.whl", hash = "sha256:c500f02867515e6c60a27875b408920d18332ddf96b4035ef03beddd782d4281"}, - {file = "macholib-1.14.tar.gz", hash = "sha256:0c436bc847e7b1d9bda0560351bf76d7caf930fb585a828d13608839ef42c432"}, -] markupsafe = [ {file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"}, {file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"}, @@ -529,9 +493,6 @@ packaging = [ {file = "packaging-20.3-py2.py3-none-any.whl", hash = "sha256:82f77b9bee21c1bafbf35a84905d604d5d1223801d639cf3ed140bd651c08752"}, {file = "packaging-20.3.tar.gz", hash = "sha256:3c292b474fda1671ec57d46d739d072bfd495a4f51ad01a055121d81e952b7a3"}, ] -pefile = [ - {file = "pefile-2019.4.18.tar.gz", hash = "sha256:a5d6e8305c6b210849b47a6174ddf9c452b2888340b8177874b862ba6c207645"}, -] pluggy = [ {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, @@ -580,11 +541,11 @@ pyparsing = [ {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, ] pyqt5 = [ - {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-abi3-macosx_10_6_intel.whl", hash = "sha256:a9bdc46ab1f6397770e6b8dca84ac07a0250d26b1a31587f25619cf31a075532"}, - {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-abi3-manylinux2014_x86_64.whl", hash = "sha256:ee168a486c9a758511568147815e2959652cd0aabea832fa5e87cf6b241d2180"}, - {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-none-win32.whl", hash = "sha256:f61ddc78547d6ca763323ccd4a9e374c71b29feda1f5ce2d3e91e4f8d2cf1942"}, - {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-none-win_amd64.whl", hash = "sha256:3b91dd1d0cbfaea85ad057247ba621187e511434b0c9d6d40de69fd5e833b109"}, - {file = "PyQt5-5.14.2.tar.gz", hash = "sha256:bd230c6fd699eabf1ceb51e13a8b79b74c00a80272c622427b80141a22269eb0"}, + {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-abi3-macosx_10_6_intel.whl", hash = "sha256:895d4101f7f8c82bc728d7eb9da1c756955ce27a0c945eafe7f234dd03402853"}, + {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl", hash = "sha256:a757ba71c51f428b52ba404e781e2f19b4436b2c31298b8313339d5817781b65"}, + {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-none-win32.whl", hash = "sha256:cc3529c0f7cbbe7491073458d5d15e7518ce544ad8c627f485e5db8a27fcaf61"}, + {file = "PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-none-win_amd64.whl", hash = "sha256:0dcc128b72f83cce0fc7926c83f05a9b74b652b5eb31a4ab71693ac8829e73c8"}, + {file = "PyQt5-5.14.0.tar.gz", hash = "sha256:0145a6b7de15756366decb736c349a0cb510d706c83fda5b8cd9e0557bc1da72"}, ] pyqt5-sip = [ {file = "PyQt5_sip-12.7.2-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:df4f5cdb86f47df5f6fc35be29cc45df7b5a2c171d07dbf377d558b226554ea3"}, diff --git a/pyproject.toml b/pyproject.toml index 6db1a2c4..424930f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,27 +7,15 @@ license = "GPLv3+" [tool.poetry.dependencies] python = "^3.6" -altgraph = "*" -certifi = "*" -chardet = "*" Click = "*" Flask = "*" Flask-HTTPAuth = "*" -future = "*" -idna = "*" -itsdangerous = "*" -Jinja2 = "*" -macholib = "*" -MarkupSafe = "*" -pefile = "*" pycryptodome = "*" PyQt5 = "5.14.0" PyQt5-sip = "*" PySocks = "*" requests = "*" stem = "*" -urllib3 = "*" -Werkzeug = "*" [tool.poetry.dev-dependencies] atomicwrites = "*" diff --git a/setup.py b/setup.py index c5a00dc8..7ab38916 100644 --- a/setup.py +++ b/setup.py @@ -97,7 +97,7 @@ setup( "onionshare_gui.tab.mode.receive_mode", "onionshare_gui.tab.mode.website_mode", ], - include_package_data=True, + # include_package_data=True, scripts=["install/scripts/onionshare", "install/scripts/onionshare-gui"], data_files=data_files, ) diff --git a/snap/qt-installer-script.js b/snap/qt-installer-script.js new file mode 100644 index 00000000..ab7bccb8 --- /dev/null +++ b/snap/qt-installer-script.js @@ -0,0 +1,78 @@ +// This script is here for convenience. Minify it and copy it into the +// qt5 override-build section of snapcraft.yaml + +function Controller() { + installer.installationFinished.connect(proceed) +} + +function logCurrentPage() { + var pageName = page().objectName + var pagePrettyTitle = page().title + console.log('At page: ' + pageName + ' (' + pagePrettyTitle + ')') +} + +function page() { + return gui.currentPageWidget() +} + +function proceed(button, delay) { + gui.clickButton(button || buttons.NextButton, delay) +} + +Controller.prototype.WelcomePageCallback = function () { + logCurrentPage() + proceed(buttons.NextButton, 2000) +} + +Controller.prototype.CredentialsPageCallback = function () { + logCurrentPage() + proceed() +} + +Controller.prototype.IntroductionPageCallback = function () { + logCurrentPage() + proceed() +} + +Controller.prototype.TargetDirectoryPageCallback = function () { + logCurrentPage() + var dir = installer.environmentVariable('SNAPCRAFT_PART_INSTALL') + '/opt/Qt5.14.0' + console.log('Installing to ' + dir) + page().TargetDirectoryLineEdit.setText(dir) + proceed() +} + +Controller.prototype.ComponentSelectionPageCallback = function () { + logCurrentPage() + page().deselectAll() + page().selectComponent('qt.qt5.5140.gcc_64') + proceed() +} + +Controller.prototype.LicenseAgreementPageCallback = function () { + logCurrentPage() + page().AcceptLicenseRadioButton.checked = true + gui.clickButton(buttons.NextButton) +} + +Controller.prototype.ReadyForInstallationPageCallback = function () { + logCurrentPage() + proceed() +} + +Controller.prototype.PerformInstallationPageCallback = function () { + logCurrentPage() +} + +Controller.prototype.FinishedPageCallback = function () { + logCurrentPage() + proceed(buttons.FinishButton) +} + +Controller.prototype.DynamicTelemetryPluginFormCallback = function () { + logCurrentPage() + console.log(Object.keys(page().TelemetryPluginForm.statisticGroupBox)) + var radioButtons = page().TelemetryPluginForm.statisticGroupBox + radioButtons.disableStatisticRadioButton.checked = true + proceed() +} \ No newline at end of file diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 84104cd8..caa8f884 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -41,34 +41,86 @@ parts: python-version: python3 python-packages: - poetry + - setuptools + - wheel + - Click + - Flask + - Flask-HTTPAuth + - pycryptodome + - PyQt5 == "5.14.0" + - PyQt5-sip + - PySocks + - requests + - stem stage-packages: - libatk-bridge2.0-0 - libatspi2.0-0 - libgtk-3-0 - - python3-pyqt5 after: [qt5, tor, obfs4] # Install Qt5 pre-compiled binary, because it's much simpler than # building from source qt5: plugin: nil + override-pull: | + #wget https://download.qt.io/official_releases/qt/5.14/5.14.0/qt-opensource-linux-x64-5.14.0.run + wget http://10.51.172.1:8000/qt-opensource-linux-x64-5.14.0.run + echo "4379f147c6793ec7e7349d2f9ee7d53b8ab6ea4e4edf8ee0574a75586a6a6e0e *qt-opensource-linux-x64-5.14.0.run" | shasum -a 256 --check + chmod +x qt-opensource-linux-x64-5.14.0.run build-packages: - xvfb - libdbus-1-3 - libxkbcommon-x11-0 - libxkbcommon-x11-dev - libfontconfig1 - override-pull: | - wget https://download.qt.io/official_releases/qt/5.14/5.14.0/qt-opensource-linux-x64-5.14.0.run - echo "4379f147c6793ec7e7349d2f9ee7d53b8ab6ea4e4edf8ee0574a75586a6a6e0e *qt-opensource-linux-x64-5.14.0.run" | shasum -a 256 --check - chmod +x qt-opensource-linux-x64-5.14.0.run override-build: | # qt-installer-script.js - echo "function Controller(){installer.installationFinished.connect(proceed)}function logCurrentPage(){var pageName=page().objectName;var pagePrettyTitle=page().title;console.log(\"At page: \"+pageName+\" ('\"+pagePrettyTitle+\"')\")}function page(){return gui.currentPageWidget()}function proceed(button,delay){gui.clickButton(button||buttons.NextButton,delay)}Controller.prototype.WelcomePageCallback=function(){logCurrentPage();proceed(buttons.NextButton,2000)};Controller.prototype.CredentialsPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.IntroductionPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.TargetDirectoryPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.ComponentSelectionPageCallback=function(){logCurrentPage();page().deselectAll();page().selectComponent(\"qt.qt5.5140.gcc_64\");proceed()};Controller.prototype.LicenseAgreementPageCallback=function(){logCurrentPage();page().AcceptLicenseRadioButton.checked=true;gui.clickButton(buttons.NextButton)};Controller.prototype.ReadyForInstallationPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.PerformInstallationPageCallback=function(){logCurrentPage()};Controller.prototype.FinishedPageCallback=function(){logCurrentPage();proceed(buttons.FinishButton)};Controller.prototype.DynamicTelemetryPluginFormCallback=function(){logCurrentPage();console.log(Object.keys(page().TelemetryPluginForm.statisticGroupBox));var radioButtons=page().TelemetryPluginForm.statisticGroupBox;radioButtons.disableStatisticRadioButton.checked=true;proceed()};" > qt-installer-script.js + echo "function Controller(){installer.installationFinished.connect(proceed)}function logCurrentPage(){var pageName=page().objectName;var pagePrettyTitle=page().title;console.log('At page: '+pageName+' ('+pagePrettyTitle+')')}function page(){return gui.currentPageWidget()}function proceed(button,delay){gui.clickButton(button||buttons.NextButton,delay)}Controller.prototype.WelcomePageCallback=function(){logCurrentPage();proceed(buttons.NextButton,2000)};Controller.prototype.CredentialsPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.IntroductionPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.TargetDirectoryPageCallback=function(){logCurrentPage();var dir=installer.environmentVariable('SNAPCRAFT_PART_INSTALL')+'/opt/Qt5.14.0';console.log('Installing to '+dir);page().TargetDirectoryLineEdit.setText(dir);proceed()};Controller.prototype.ComponentSelectionPageCallback=function(){logCurrentPage();page().deselectAll();page().selectComponent('qt.qt5.5140.gcc_64');proceed()};Controller.prototype.LicenseAgreementPageCallback=function(){logCurrentPage();page().AcceptLicenseRadioButton.checked=true;gui.clickButton(buttons.NextButton)};Controller.prototype.ReadyForInstallationPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.PerformInstallationPageCallback=function(){logCurrentPage()};Controller.prototype.FinishedPageCallback=function(){logCurrentPage();proceed(buttons.FinishButton)};Controller.prototype.DynamicTelemetryPluginFormCallback=function(){logCurrentPage();console.log(Object.keys(page().TelemetryPluginForm.statisticGroupBox));var radioButtons=page().TelemetryPluginForm.statisticGroupBox;radioButtons.disableStatisticRadioButton.checked=true;proceed()};" > qt-installer-script.js # Disable Qt installer from phoning home via hosts file echo "127.0.0.1 iapi.qt.io.herokudns.com" >> /etc/hosts # Install Qt5 + rm -rf $SNAPCRAFT_PART_INSTALL/opt/Qt5.14.0 xvfb-run ./qt-opensource-linux-x64-5.14.0.run --script qt-installer-script.js --verbose + stage-packages: + - libdrm2 + - libfontconfig1 + - libfreetype6 + - libgl1 + - libglvnd0 + - libglx0 + - libpng16-16 + - libx11-6 + - libx11-xcb1 + - libxau6 + - libxcb-glx0 + - libxcb-xkb1 + - libxcb1 + - libxdmcp6 + - libxext6 + - libxkbcommon-x11-0 + - libxkbcommon0 + - libegl1 + - libasound2 + - libbluetooth3 + - libcairo-gobject2 + - libcairo2 + - libcups2 + - libgdk-pixbuf2.0-0 + - libgtk3.0-cil + - libgstreamer-plugins-base1.0-0 + - libodbc1 + - libpango-1.0-0 + - libpangocairo-1.0-0 + - libpq5 + - libpulse-mainloop-glib0 + - libpulse0 + - libspeechd2 + - libwayland-client0 + - libwayland-cursor0 + - libwayland-egl1 + - libxml2 + - libqt5webengine5 + - libqt5webenginecore5 tor: source: https://dist.torproject.org/tor-0.4.2.7.tar.gz