From 886ce1e1a1eb5cba9941b47c9dc79a09916b8bf3 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 4 Sep 2016 19:36:56 -0700 Subject: [PATCH] Add instructions for installing cx_Freeze in Windows, and add cx_Freeze support to setup.py for Windows --- BUILD.md | 10 ++++++- setup.py | 86 ++++++++++++++++++++++++++++++++++---------------------- 2 files changed, 62 insertions(+), 34 deletions(-) diff --git a/BUILD.md b/BUILD.md index 4027a32d..971bdb8a 100644 --- a/BUILD.md +++ b/BUILD.md @@ -98,7 +98,15 @@ Download the latest Python 3.5.x, 32-bit (x86) from https://www.python.org/downl Download and install Qt5 from https://www.qt.io/download-open-source/. I downloaded `qt-unified-windows-x86-2.0.3-1-online.exe`. There's no need to login to a Qt account during installation. Make sure you install the latest Qt 5.x. -Open a command prompt and install some dependencies with pip: `pip install pyinstaller==3.1.1 pypiwin32 flask stem PyQt5` +Installing cx_Freeze with support for python 3.5 is annoying. Here are the steps (thanks https://github.com/sekrause/cx_Freeze-Wheels): + +* Download and install the Visual C++ Build Tools 2005 from http://go.microsoft.com/fwlink/?LinkId=691126. I downloaded `visualcppbuildtools_full.exe`. +* Install the python wheel package: `pip install wheel` +* Download a [snapshot](https://bitbucket.org/anthony_tuininga/cx_freeze/downloads) of the latest development version of cx_Freeze, extract it, and cd into the folder you extracted it to +* Build the package: `python setup.py bdist_wheel` +* Install it with pip: `pip install dist\cx_Freeze-5.0-cp35-cp35m-win32.whl` + +Open a command prompt and install dependencies with pip: `pip install pypiwin32 flask stem PyQt5` Download and install the [Microsoft Visual C++ 2008 Redistributable Package (x86)](http://www.microsoft.com/en-us/download/details.aspx?id=29). diff --git a/setup.py b/setup.py index 95273dd4..c0bac7bf 100644 --- a/setup.py +++ b/setup.py @@ -19,12 +19,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import os, sys - -try: - from setuptools import setup -except ImportError: - from distutils.core import setup +import os, sys, platform def file_list(path): files = [] @@ -77,30 +72,55 @@ html = [ 'resources/html/404.html' ] -setup( - name='onionshare', - version=version, - description=description, - long_description=long_description, - author='Micah Lee', - author_email='micah@micahflee.com', - url='https://github.com/micahflee/onionshare', - license="GPL v3", - keywords='onion, share, onionshare, tor, anonymous, web server', - packages=['onionshare', 'onionshare_gui'], - include_package_data=True, - scripts=['install/scripts/onionshare', 'install/scripts/onionshare-gui'], - data_files=[ - (os.path.join(sys.prefix, 'share/applications'), ['install/onionshare.desktop']), - (os.path.join(sys.prefix, 'share/appdata'), ['install/onionshare.appdata.xml']), - (os.path.join(sys.prefix, 'share/pixmaps'), ['install/onionshare80.xpm']), - (os.path.join(sys.prefix, 'share/onionshare'), [ - 'resources/version.txt', - 'resources/wordlist.txt' - ]), - (os.path.join(sys.prefix, 'share/onionshare/images'), images), - (os.path.join(sys.prefix, 'share/onionshare/locale'), locale), - (os.path.join(sys.prefix, 'share/onionshare/html'), html), - ('/usr/share/nautilus-python/extensions/', ['install/scripts/onionshare-nautilus.py']), - ] -) +os = platform.system() + +if os == 'Windows': + from cx_Freeze import setup, Executable + #base = "Win32GUI" + base = None + setup( + name="onionshare", + version=version, + description=description, + long_description=long_description, + options={ + "build_exe": { + "packages": [], + "excludes": [] + } + }, + executables=[ + Executable("install/scripts/onionshare", base=base), + Executable("install/scripts/onionshare-gui", base=base) + ] + ) + +else: + from setuptools import setup + setup( + name='onionshare', + version=version, + description=description, + long_description=long_description, + author='Micah Lee', + author_email='micah@micahflee.com', + url='https://github.com/micahflee/onionshare', + license="GPL v3", + keywords='onion, share, onionshare, tor, anonymous, web server', + packages=['onionshare', 'onionshare_gui'], + include_package_data=True, + scripts=['install/scripts/onionshare', 'install/scripts/onionshare-gui'], + data_files=[ + (os.path.join(sys.prefix, 'share/applications'), ['install/onionshare.desktop']), + (os.path.join(sys.prefix, 'share/appdata'), ['install/onionshare.appdata.xml']), + (os.path.join(sys.prefix, 'share/pixmaps'), ['install/onionshare80.xpm']), + (os.path.join(sys.prefix, 'share/onionshare'), [ + 'resources/version.txt', + 'resources/wordlist.txt' + ]), + (os.path.join(sys.prefix, 'share/onionshare/images'), images), + (os.path.join(sys.prefix, 'share/onionshare/locale'), locale), + (os.path.join(sys.prefix, 'share/onionshare/html'), html), + ('/usr/share/nautilus-python/extensions/', ['install/scripts/onionshare-nautilus.py']), + ] + )