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:
cache: false
language: python
python: '3.6'
python: '3.7'
install:
- travis_retry pip install flake8==3.5.0
- travis_retry pip install codespell==1.15.0

View file

@ -415,8 +415,8 @@ class BasicSwap():
if not os.path.exists(authcookiepath):
time.sleep(0.5)
try:
with open(authcookiepath) as fp:
rpcauth = fp.read()
with open(authcookiepath, 'rb') as fp:
rpcauth = fp.read().decode('utf-8')
except Exception:
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):
bindir = self.coin_clients[coin_type]['bindir']
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)
args = command_cli + chainname + ' ' + '-datadir=' + datadir + ' ' + params
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 mmap
import tarfile
import zipfile
import stat
import time
from urllib.request import urlretrieve
@ -33,6 +34,8 @@ from bin.basicswap_run import startDaemon
if platform.system() == 'Darwin':
BIN_ARCH = 'osx64.tar.gz'
elif platform.system() == 'Windows':
BIN_ARCH = 'win64.zip'
else:
BIN_ARCH = 'x86_64-linux-gnu.tar.gz'
@ -167,14 +170,23 @@ def prepareCore(coin, version, settings, data_dir):
raise ValueError('Signature verification failed.')
bins = [coin + 'd', coin + '-cli', coin + '-tx']
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)
if os_name == 'win':
with zipfile.ZipFile(release_path) as fz:
for b in bins:
b += '.exe'
out_path = os.path.join(bin_dir, b)
with open(out_path, 'wb') as fout:
fout.write(fz.read('{}-{}/bin/{}'.format(coin, version, b)))
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):

View file

@ -70,3 +70,20 @@ To run in a different directory and on testnet:
$ pip3 install .
$ basicswap-prepare
$ 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.