Prepare windows releases.

This commit is contained in:
tecnovert 2019-07-28 14:45:26 +02:00
parent 7c9ff485e3
commit 18ee89361a
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
4 changed files with 41 additions and 12 deletions

View file

@ -34,7 +34,7 @@ jobs:
env: env:
cache: false cache: false
language: python language: python
python: '3.6' python: '3.7'
install: install:
- travis_retry pip install flake8==3.5.0 - travis_retry pip install flake8==3.5.0
- travis_retry pip install codespell==1.15.0 - travis_retry pip install codespell==1.15.0

View file

@ -415,8 +415,8 @@ class BasicSwap():
if not os.path.exists(authcookiepath): if not os.path.exists(authcookiepath):
time.sleep(0.5) time.sleep(0.5)
try: try:
with open(authcookiepath) as fp: with open(authcookiepath, 'rb') as fp:
rpcauth = fp.read() rpcauth = fp.read().decode('utf-8')
except Exception: except Exception:
self.log.warning('Unable to read authcookie for %s, %s', str(coin), authcookiepath) self.log.warning('Unable to read authcookie for %s, %s', str(coin), authcookiepath)
@ -2333,7 +2333,7 @@ class BasicSwap():
def callcoincli(self, coin_type, params, wallet=None): def callcoincli(self, coin_type, params, wallet=None):
bindir = self.coin_clients[coin_type]['bindir'] bindir = self.coin_clients[coin_type]['bindir']
datadir = self.coin_clients[coin_type]['datadir'] datadir = self.coin_clients[coin_type]['datadir']
command_cli = os.path.join(bindir, chainparams[coin_type]['name'] + '-cli') command_cli = os.path.join(bindir, chainparams[coin_type]['name'] + '-cli' + ('.exe' if os.name == 'nt' else ''))
chainname = '' if self.chain == 'mainnet' else (' -' + self.chain) chainname = '' if self.chain == 'mainnet' else (' -' + self.chain)
args = command_cli + chainname + ' ' + '-datadir=' + datadir + ' ' + params args = command_cli + chainname + ' ' + '-datadir=' + datadir + ' ' + params
p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)

View file

@ -18,6 +18,7 @@ import json
import hashlib import hashlib
import mmap import mmap
import tarfile import tarfile
import zipfile
import stat import stat
import time import time
from urllib.request import urlretrieve from urllib.request import urlretrieve
@ -33,6 +34,8 @@ from bin.basicswap_run import startDaemon
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
BIN_ARCH = 'osx64.tar.gz' BIN_ARCH = 'osx64.tar.gz'
elif platform.system() == 'Windows':
BIN_ARCH = 'win64.zip'
else: else:
BIN_ARCH = 'x86_64-linux-gnu.tar.gz' BIN_ARCH = 'x86_64-linux-gnu.tar.gz'
@ -167,14 +170,23 @@ def prepareCore(coin, version, settings, data_dir):
raise ValueError('Signature verification failed.') raise ValueError('Signature verification failed.')
bins = [coin + 'd', coin + '-cli', coin + '-tx'] bins = [coin + 'd', coin + '-cli', coin + '-tx']
with tarfile.open(release_path) as ft: if os_name == 'win':
for b in bins: with zipfile.ZipFile(release_path) as fz:
out_path = os.path.join(bin_dir, b) for b in bins:
fi = ft.extractfile('{}-{}/bin/{}'.format(coin, version, b)) b += '.exe'
with open(out_path, 'wb') as fout: out_path = os.path.join(bin_dir, b)
fout.write(fi.read()) with open(out_path, 'wb') as fout:
fi.close() fout.write(fz.read('{}-{}/bin/{}'.format(coin, version, b)))
os.chmod(out_path, stat.S_IRWXU | stat.S_IXGRP | stat.S_IXOTH) os.chmod(out_path, stat.S_IRWXU | stat.S_IXGRP | stat.S_IXOTH)
else:
with tarfile.open(release_path) as ft:
for b in bins:
out_path = os.path.join(bin_dir, b)
fi = ft.extractfile('{}-{}/bin/{}'.format(coin, version, b))
with open(out_path, 'wb') as fout:
fout.write(fi.read())
fi.close()
os.chmod(out_path, stat.S_IRWXU | stat.S_IXGRP | stat.S_IXOTH)
def prepareDataDir(coin, settings, data_dir, chain, particl_mnemonic): def prepareDataDir(coin, settings, data_dir, chain, particl_mnemonic):

View file

@ -70,3 +70,20 @@ To run in a different directory and on testnet:
$ pip3 install . $ pip3 install .
$ basicswap-prepare $ basicswap-prepare
$ basicswap-run $ basicswap-run
# Windows
Install git and python3
Right click in the directory you want to install into and select 'Git Bash Here':
$ git clone https://github.com/tecnovert/basicswap.git
$ cd basicswap
$ pip3 install .
$ basicswap-prepare
$ basicswap-run
Open url in browser:
http://localhost:12700
Shutdown by pressibg ctrl + c in the Git Bash console window.