Merge pull request #12 from DaveA50/master
Enable building and installing of GUI for windows
This commit is contained in:
commit
0c80134523
4 changed files with 133 additions and 5 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -13,3 +13,7 @@
|
|||
lbrynet.egg-info/PKG-INFO
|
||||
|
||||
*.egg
|
||||
|
||||
/build
|
||||
|
||||
/dist
|
||||
|
|
35
INSTALL.md
35
INSTALL.md
|
@ -38,3 +38,38 @@ python setup.py install
|
|||
this will install all of the libraries and a few applications
|
||||
|
||||
For running the file sharing application, see [RUNNING](RUNNING.md)
|
||||
|
||||
#### On windows:
|
||||
|
||||
Install [mingw32](http://www.mingw.org/) base and c++ compiler.
|
||||
|
||||
Add C:\MinGW\bin to the windows PATH.
|
||||
|
||||
Enable distutils to compile with mingw32 by creating a distutils.cfg file in *PYTHONPATH\Lib\distutils* containing
|
||||
```
|
||||
[build]
|
||||
compiler = mingw32
|
||||
```
|
||||
|
||||
If using virtualenv, copy the *PYTHONPATH\Lib\distutils* directory to the virtualenv.
|
||||
|
||||
It's recommended to use [Unofficial Windows Binaries for Python Extension Packages](http://www.lfd.uci.edu/~gohlke/pythonlibs/) for as many of the required packages as possible.
|
||||
Currently, available binaries include:
|
||||
- Cython
|
||||
- Twisted
|
||||
- Zope.interface
|
||||
- pywin32
|
||||
- Yapsy
|
||||
- cx_Freeze
|
||||
- requests
|
||||
- gmpy
|
||||
|
||||
Install the each of the preceding binaries with `pip install *.whl`
|
||||
|
||||
Install pywin32 system files by run `python.exe Scripts\pywin32_postinstall.py -install` from an elevated command prompt.
|
||||
|
||||
Install the rest of the required modules with the standard `pip install module` command
|
||||
|
||||
The one module which requires additional work is [miniupnpc](https://pypi.python.org/pypi/miniupnpc/1.9).
|
||||
Download the source and compile with MinGW by running `mingw32make.bat`
|
||||
Then install the module by running `python setupmingw32.py install`
|
||||
|
|
|
@ -69,7 +69,7 @@ class DownloaderApp(object):
|
|||
|
||||
if os.name == "nt":
|
||||
root.iconbitmap(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])),
|
||||
"lbrynet", "lbrynet_downloader_gui", "lbry-dark-icon.ico"))
|
||||
"lbry-dark-icon.ico"))
|
||||
else:
|
||||
root.wm_iconbitmap("@" + os.path.join(os.path.dirname(__file__), "lbry-dark-icon.xbm"))
|
||||
|
||||
|
@ -111,8 +111,7 @@ class DownloaderApp(object):
|
|||
|
||||
logo_file_name = "lbry-dark-242x80.gif"
|
||||
if os.name == "nt":
|
||||
logo_file = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "lbrynet",
|
||||
"lbrynet_downloader_gui", logo_file_name)
|
||||
logo_file = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), logo_file_name)
|
||||
else:
|
||||
logo_file = os.path.join(os.path.dirname(__file__), logo_file_name)
|
||||
|
||||
|
@ -142,8 +141,8 @@ class DownloaderApp(object):
|
|||
|
||||
dropdown_file_name = "drop_down.gif"
|
||||
if os.name == "nt":
|
||||
dropdown_file = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "lbrynet",
|
||||
"lbrynet_downloader_gui", dropdown_file_name)
|
||||
dropdown_file = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])),
|
||||
dropdown_file_name)
|
||||
else:
|
||||
dropdown_file = os.path.join(os.path.dirname(__file__), dropdown_file_name)
|
||||
|
||||
|
|
90
setup_win32.py
Normal file
90
setup_win32.py
Normal file
|
@ -0,0 +1,90 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
To create local builds and distributable .msi, run the following command:
|
||||
python setup_win32.py build bdist_msi
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
from cx_Freeze import setup, Executable
|
||||
|
||||
|
||||
def find_data_file(filename):
|
||||
if getattr(sys, 'frozen', False):
|
||||
# The application is frozen
|
||||
data_dir = os.path.dirname(sys.executable)
|
||||
else:
|
||||
# The application is not frozen
|
||||
# Change this bit to match where you store your data files:
|
||||
data_dir = os.path.dirname(__file__)
|
||||
return os.path.join(data_dir, filename)
|
||||
|
||||
shortcut_table = [
|
||||
('DesktopShortcut', # Shortcut
|
||||
'DesktopFolder', # Directory
|
||||
'LBRY', # Name
|
||||
'TARGETDIR', # Component
|
||||
'[TARGETDIR]\LBRY.exe', # Target
|
||||
None, # Arguments
|
||||
None, # Description
|
||||
None, # Hotkey
|
||||
os.path.join('lbrynet', 'lbrynet_gui', 'lbry-dark-icon.ico'), # Icon
|
||||
None, # IconIndex
|
||||
None, # ShowCmd
|
||||
'TARGETDIR', # WkDir
|
||||
),
|
||||
]
|
||||
|
||||
# Now create the table dictionary
|
||||
msi_data = {'Shortcut': shortcut_table}
|
||||
|
||||
bdist_msi_options = {
|
||||
'upgrade_code': '{66620F3A-DC3A-11E2-B341-002219E9B01F}',
|
||||
'add_to_path': False,
|
||||
'initial_target_dir': r'[LocalAppDataFolder]\LBRY',
|
||||
'data': msi_data,
|
||||
}
|
||||
|
||||
build_exe_options = {
|
||||
'include_msvcr': True,
|
||||
'includes': [],
|
||||
'packages': ['os', 'twisted', 'miniupnpc', 'unqlite', 'seccure',
|
||||
'requests', 'bitcoinrpc', 'txjsonrpc', 'win32api', 'Crypto',
|
||||
'gmpy', 'yapsy'],
|
||||
'excludes': ['zope.interface._zope_interface_coptimizations'],
|
||||
'include_files': [os.path.join('lbrynet', 'lbrynet_gui', 'close.gif'),
|
||||
os.path.join('lbrynet', 'lbrynet_gui', 'close1.png'),
|
||||
os.path.join('lbrynet', 'lbrynet_gui', 'close2.gif'),
|
||||
os.path.join('lbrynet', 'lbrynet_gui', 'drop_down.gif'),
|
||||
os.path.join('lbrynet', 'lbrynet_gui', 'hide_options.gif'),
|
||||
os.path.join('lbrynet', 'lbrynet_gui', 'lbry-dark-242x80.gif'),
|
||||
os.path.join('lbrynet', 'lbrynet_gui', 'lbry-dark-icon.ico'),
|
||||
os.path.join('lbrynet', 'lbrynet_gui', 'lbry-dark-icon.xbm'),
|
||||
os.path.join('lbrynet', 'lbrynet_gui', 'show_options.gif'),
|
||||
os.path.join('lbrycrdd.exe'), # Not included in repo
|
||||
os.path.join('lbrycrd-cli.exe'), # Not included in repo
|
||||
],
|
||||
'namespace_packages': ['zope']}
|
||||
|
||||
exe = Executable(
|
||||
script=os.path.join('lbrynet', 'lbrynet_gui', 'gui.py'),
|
||||
base='Win32GUI',
|
||||
icon=os.path.join('lbrynet', 'lbrynet_gui', 'lbry-dark-icon.ico'),
|
||||
compress=True,
|
||||
shortcutName='LBRY',
|
||||
shortcutDir='DesktopFolder',
|
||||
targetName='LBRY.exe'
|
||||
# targetDir="LocalAppDataFolder"
|
||||
)
|
||||
|
||||
setup(
|
||||
name='LBRY',
|
||||
version='0.0.4',
|
||||
description='A fully decentralized network for distributing data',
|
||||
url='lbry.io',
|
||||
author='',
|
||||
keywords='LBRY',
|
||||
options={'build_exe': build_exe_options,
|
||||
'bdist_msi': bdist_msi_options},
|
||||
executables=[exe],
|
||||
)
|
Loading…
Reference in a new issue