mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Got python3/Qt5 port working in Windows, but still need to finish packaging (#261)
This commit is contained in:
parent
a11cbe4f82
commit
d1c36fa04f
16
BUILD.md
16
BUILD.md
@ -100,24 +100,24 @@ Now you should have `dist/OnionShare.pkg`.
|
||||
|
||||
### Setting up your dev environment
|
||||
|
||||
TODO: Still need to make this working in Windows with Python3.
|
||||
These instructions include adding folders to the path in Windows. To do this, go to Start and type "advanced system settings", and open "View advanced system settings" in the Control Panel. Click Environment Variables. Under "System variables" double-click on Path. From there you can add and remove folders that are available in the PATH.
|
||||
|
||||
Install the [latest Python 3.x from python.org](https://www.python.org/downloads/). While installing, check the box "Add Python 3.x to PATH".
|
||||
First, download and install the 32-bit (x86) version of Python 3.4.x from https://www.python.org/downloads/windows/. You need 3.4 instead of 3.5 because PyQt5 was built with 3.4. Add `C:\Python34` and `C:\Python34\Scripts` to the path.
|
||||
|
||||
Open a command prompt and install some dependencies with pip: `pip install flask stem pyinstaller`
|
||||
|
||||
Download and install Qt5 from https://www.qt.io/download-open-source/. I downloaded `qt-unified-windows-x86-2.0.2-2-online.exe`. There's no need to login to a Qt account during installation. Make sure you install the latest Qt 5.x.
|
||||
|
||||
Download and install the latest PyQt5 for 32-bit Windows from https://www.riverbankcomputing.com/software/pyqt/download5. I downloaded `PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x32.exe`. Make sure to install it to the location where you installed Python (in my case, `C:\Users\micah\AppData\Local\Programs\Python\Python35-32\`).
|
||||
Download and install the latest PyQt5 for 32-bit Windows from https://www.riverbankcomputing.com/software/pyqt/download5. I downloaded `PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x32.exe`.
|
||||
|
||||
Download and install the latest 32-bit pywin32 binary for Python 3.5 from http://sourceforge.net/projects/pywin32/. I downloaded `pywin32-220.win32-py3.5.exe`.
|
||||
Download and install the latest 32-bit pywin32 binary for Python 3.4 from http://sourceforge.net/projects/pywin32/. I downloaded `pywin32-220.win32-py3.4.exe`.
|
||||
|
||||
Download and install the [Microsoft Visual C++ 2008 Redistributable Package (x86)](http://www.microsoft.com/en-us/download/details.aspx?id=29).
|
||||
|
||||
If you want to build the installer:
|
||||
|
||||
* Go to http://nsis.sourceforge.net/Download and download the latest NSIS. I downloaded `nsis-3.0b0-setup.exe`.
|
||||
* Go to Start and type "advanced system settings", and open "View advanced system settings" in the Control Panel. Click Environment Variables. Under "System variables" double-click on Path, and add `C:\Program Files (x86)\NSIS` to the end. Now you can just type `makensis [script]` to build an installer.
|
||||
* Add `C:\Program Files (x86)\NSIS` to the path.
|
||||
|
||||
If you want to sign binaries with Authenticode:
|
||||
|
||||
@ -126,10 +126,10 @@ If you want to sign binaries with Authenticode:
|
||||
* Windows 7:
|
||||
* Go to http://msdn.microsoft.com/en-us/vstudio/aa496123 and install the latest .NET Framework. I installed `.NET Framework 4.6`.
|
||||
* Go to http://www.microsoft.com/en-us/download/confirmation.aspx?id=8279 and install the Windows SDK.
|
||||
* Right click on Computer, go to Properties. Click "Advanced system settings". Click Environment Variables. Under "System variables" double-click on Path and add `C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin` to the end.
|
||||
* Add `C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin` to the path.
|
||||
* Windows 10:
|
||||
* Go to https://dev.windows.com/en-us/downloads/windows-10-sdk and install the standalone Windows 10 SDK. Note that you may not need this if you already have Visual Studio.
|
||||
* Go to Start and type "advanced system settings", and open "View advanced system settings" in the Control Panel. Click Environment Variables. Under "System variables" double-click on Path, and add `C:\Program Files (x86)\Windows Kits\10\bin\x86`.
|
||||
* Add `C:\Program Files (x86)\Windows Kits\10\bin\x86` to the path.
|
||||
|
||||
### To make a .exe:
|
||||
|
||||
@ -138,7 +138,7 @@ If you want to sign binaries with Authenticode:
|
||||
### To build the installer:
|
||||
|
||||
Note that you must have a codesigning certificate installed in order to use the `install\build_exe.bat` script, because it codesigns `onionshare.exe`, `uninstall.exe`, and `OnionShare_Setup.exe`.
|
||||
|
||||
s
|
||||
Open a command prompt, cd to the onionshare directory, and type: `install\build_exe.bat`
|
||||
|
||||
This will prompt you to codesign three binaries and execute one unsigned binary. When you're done clicking through everything you will have `dist\OnionShare_Setup.exe`.
|
||||
|
@ -19,11 +19,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
from __future__ import division
|
||||
import os, sys, subprocess, time, hashlib, platform, json, locale, socket
|
||||
import argparse, Queue, inspect, base64, random, functools, logging, ctypes
|
||||
import argparse, queue, inspect, base64, random, functools, logging, ctypes
|
||||
import hmac, shutil
|
||||
from itertools import izip
|
||||
import stem, stem.control, flask
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
||||
|
||||
import onionshare, onionshare_gui
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
a = Analysis(['onionshare-launcher.py'],
|
||||
hiddenimports=['onionshare', 'onionshare_gui'],
|
||||
excludes=['_tkinter'],
|
||||
#hiddenimports=['onionshare', 'onionshare_gui'],
|
||||
#excludes=['_tkinter'],
|
||||
hookspath=None,
|
||||
runtime_hooks=None)
|
||||
a.datas += [
|
||||
@ -22,6 +22,7 @@ a.datas += [
|
||||
('locale/pt.json', 'locale/pt.json', 'DATA'),
|
||||
('locale/ru.json', 'locale/ru.json', 'DATA'),
|
||||
('locale/tr.json', 'locale/tr.json', 'DATA'),
|
||||
('version', 'version', 'DATA'),
|
||||
]
|
||||
pyz = PYZ(a.pure)
|
||||
exe = EXE(pyz,
|
||||
@ -32,7 +33,7 @@ exe = EXE(pyz,
|
||||
strip=False,
|
||||
upx=True,
|
||||
icon='install/onionshare.ico',
|
||||
console=False )
|
||||
console=False)
|
||||
coll = COLLECT(exe,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
|
@ -161,20 +161,6 @@ class ServerStatus(QtWidgets.QVBoxLayout):
|
||||
"""
|
||||
url = 'http://{0:s}/{1:s}'.format(self.app.onion_host, self.web.slug)
|
||||
|
||||
if platform.system() == 'Windows':
|
||||
# Qt's QClipboard isn't working in Windows
|
||||
# https://github.com/micahflee/onionshare/issues/46
|
||||
import ctypes
|
||||
GMEM_DDESHARE = 0x2000
|
||||
ctypes.windll.user32.OpenClipboard(None)
|
||||
ctypes.windll.user32.EmptyClipboard()
|
||||
hcd = ctypes.windll.kernel32.GlobalAlloc(GMEM_DDESHARE, len(bytes(url)) + 1)
|
||||
pch_data = ctypes.windll.kernel32.GlobalLock(hcd)
|
||||
ctypes.cdll.msvcrt.strcpy(ctypes.c_char_p(pch_data), bytes(url))
|
||||
ctypes.windll.kernel32.GlobalUnlock(hcd)
|
||||
ctypes.windll.user32.SetClipboardData(1, hcd)
|
||||
ctypes.windll.user32.CloseClipboard()
|
||||
else:
|
||||
clipboard = self.qtapp.clipboard()
|
||||
clipboard.setText(url)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user