diff --git a/.gitignore b/.gitignore index 7acd6d7..57b9994 100644 --- a/.gitignore +++ b/.gitignore @@ -24,12 +24,6 @@ var/ MANIFEST .eggs -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - # Installer logs pip-log.txt pip-delete-this-directory.txt diff --git a/docs/api.md b/docs/api.md index 4361ec2..97fdbd7 100644 --- a/docs/api.md +++ b/docs/api.md @@ -141,10 +141,10 @@ optional arguments: ## Code Management Each wormhole connection is defined by a shared secret "wormhole code". These -codes can be generated offline (by picking a unique number and some secret -words), but are more commonly generated by whoever creates the first -wormhole. In the "bin/wormhole" file-transfer tool, the default behavior is -for the sender to create the code, and for the receiver to type it in. +codes can be created by humans offline (by picking a unique number and some +secret words), but are more commonly generated by asking the library to make +one. In the "bin/wormhole" file-transfer tool, the default behavior is for +the sender's program to create the code, and for the receiver to type it in. The code is a (unicode) string in the form `NNN-code-words`. The numeric "NNN" prefix is the "channel id" or "nameplate", and is a short integer @@ -161,7 +161,7 @@ The Wormhole object has three APIs for generating or accepting a code: * `w.allocate_code(length=2)`: this contacts the Rendezvous Server, allocates a short numeric nameplate, chooses a configurable number of random words, then assembles them into the code -* `w.set_code(code)`: this accepts the code as an argument +* `w.set_code(code)`: this accepts the complete code as an argument * `helper = w.input_code()`: this facilitates interactive entry of the code, with tab-completion. The helper object has methods to return a list of viable completions for whatever portion of the code has been entered so diff --git a/pyi/build-exe b/pyi/build-exe new file mode 100755 index 0000000..5c1b347 --- /dev/null +++ b/pyi/build-exe @@ -0,0 +1,17 @@ +#!/bin/sh + +# use pyinstaller to build a single-file "fat binary" called wormhole.exe. +# +# the .exe here does NOT mean a windows executable, but an executable in general. +# +# "fat binary" means it includes the python interpreter, the python source code +# and libs, compiled code parts and externally needed (C/compiled) libraries. +# it does NOT include the (g)libc though as this needs to be provided by the +# target platform and needs to match the kernel there. thus, it is a good idea +# to run the build on an old, but still security-supported linux (or other posix +# OS) to keep the minimum (g)libc requirement low. + +pyinstaller --clean --distpath=dist wormhole.exe.spec + +# result will be in dist/wormhole.exe + diff --git a/pyi/wormhole.exe.spec b/pyi/wormhole.exe.spec new file mode 100644 index 0000000..9fb6a9f --- /dev/null +++ b/pyi/wormhole.exe.spec @@ -0,0 +1,43 @@ +# -*- mode: python -*- +# this pyinstaller spec file is used to build wormhole binaries on posix platforms + +import os, sys + +# your cwd should be in the same dir as this file, so .. is the project directory: +basepath = os.path.realpath('..') + +a = Analysis([os.path.join(basepath, 'src/wormhole/__main__.py'), ], + pathex=[basepath, ], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=None) + +pyz = PYZ(a.pure, a.zipped_data, cipher=None) + +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + name='wormhole.exe', + debug=False, + strip=False, + upx=True, + console=True) + +if False: + # Enable this block to build a directory-based binary instead of + # a packed single file. + coll = COLLECT(exe, + a.binaries, + a.zipfiles, + a.datas, + strip=False, + upx=True, + name='wormhole-dir') diff --git a/setup.py b/setup.py index 21350c7..38096b3 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,7 @@ setup(name="magic-wormhole", version=versioneer.get_version(), description="Securely transfer data between computers", long_description=open('README.md', 'rU').read(), + long_description_content_type='text/markdown', author="Brian Warner", author_email="warner-magic-wormhole@lothar.com", license="MIT", @@ -49,7 +50,7 @@ setup(name="magic-wormhole", "txtorcon >= 0.19.3", ], extras_require={ - ':sys_platform=="win32"': ["pypiwin32"], + ':sys_platform=="win32"': ["pywin32"], "dev": ["mock", "tox", "pyflakes", "magic-wormhole-transit-relay==0.1.1", "magic-wormhole-mailbox-server==0.1.0"], diff --git a/src/wormhole/__main__.py b/src/wormhole/__main__.py index 568abf3..5104575 100644 --- a/src/wormhole/__main__.py +++ b/src/wormhole/__main__.py @@ -1,4 +1,4 @@ -from .cli import cli +from wormhole.cli import cli if __name__ != "__main__": raise ImportError('this module should not be imported')