From 6f42433c57ccb540f3c9d2038914feae73f77d97 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 28 May 2018 23:42:04 -0700 Subject: [PATCH 1/4] docs/api: minor rephrasings --- docs/api.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 From a333a023663b8082398fe4c9dbe94180660958ba Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 2 Jun 2018 17:53:15 +0200 Subject: [PATCH 2/4] use pyinstaller to build wormhole fat/standalone binary tested with/on: - ubuntu linux 18.04 amd64 - pyinstaller 3.3.1 (pip install pyinstaller) - python 3.6.5 There is a good chance it also works on FreeBSD, maybe also on macOS. The change in __main__.py was required because otherwise it complains about __main__ not being a package when trying the dot-relative import. --- .gitignore | 6 ------ pyi/build-exe | 17 ++++++++++++++++ pyi/wormhole.exe.spec | 43 ++++++++++++++++++++++++++++++++++++++++ src/wormhole/__main__.py | 2 +- 4 files changed, 61 insertions(+), 7 deletions(-) create mode 100755 pyi/build-exe create mode 100644 pyi/wormhole.exe.spec 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/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/src/wormhole/__main__.py b/src/wormhole/__main__.py index a47f2e5..d56a7ea 100644 --- a/src/wormhole/__main__.py +++ b/src/wormhole/__main__.py @@ -2,7 +2,7 @@ if __name__ != "__main__": raise ImportError('this module should not be imported') -from .cli import cli +from wormhole.cli import cli cli.wormhole() From 16c48a54f1470e7e7dfd1282ac08a8829044c488 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Sat, 2 Jun 2018 17:36:15 -0400 Subject: [PATCH 3/4] update Windows dependency --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 21350c7..94ab7c0 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,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"], From 21dbf00a7f701dbbcebe9f2f12b7333813c0c72f Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Tue, 12 Jun 2018 14:08:34 +0300 Subject: [PATCH 4/4] Add long_description_content_type to setup.py The new PyPI code discards long_description when it's not valid ReStructuredText. Luckily it also supports Markdown, but you have to [specify the content type](https://packaging.python.org/tutorials/packaging-projects/#creating-setup-py) explicitly in that case. (IIRC for this to work correctly you also have to use sufficiently recent versions of setuptools and twine to upload releases.) Should fix #303. --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 21350c7..67d2e99 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",