From 411b8c74cc07b005e9b291453464a5c61a57a88b Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Sun, 29 Jul 2018 00:16:57 -0400 Subject: [PATCH] travis yaml conslidation via anchors --- .travis.yml | 34 +++++++++++----------------------- lbrynet/wallet/ledger.py | 4 ++-- lbrynet/wallet/manager.py | 10 +++++----- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4b726e1c..ee07163e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,28 +58,8 @@ jobs: target_paths: - /daemon/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}_branch-${TRAVIS_BRANCH}$([ ! -z ${TRAVIS_TAG} ] && echo _tag-${TRAVIS_TAG})/win/ - - name: "Linux" - install: - - pip install pyinstaller - - pip install git+https://github.com/lbryio/torba.git - - pip install git+https://github.com/lbryio/lbryschema.git - - pip install -e . - script: - - pyinstaller -F -n lbrynet lbrynet/cli.py - - ./dist/lbrynet --version - addons: - artifacts: - working_dir: dist - paths: - - lbrynet - # artifact uploader thinks lbrynet is a directory, https://github.com/travis-ci/artifacts/issues/78 - target_paths: - - /daemon/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}_branch-${TRAVIS_BRANCH}$([ ! -z ${TRAVIS_TAG} ] && echo _tag-${TRAVIS_TAG})/linux/lbrynet - - - name: "Mac" - os: osx - osx_image: xcode9.4 - language: generic + - &build + name: "Linux" install: - pip3 install pyinstaller - pip3 install git+https://github.com/lbryio/torba.git @@ -88,6 +68,7 @@ jobs: script: - pyinstaller -F -n lbrynet lbrynet/cli.py - ./dist/lbrynet --version + env: OS=linux addons: artifacts: working_dir: dist @@ -95,7 +76,14 @@ jobs: - lbrynet # artifact uploader thinks lbrynet is a directory, https://github.com/travis-ci/artifacts/issues/78 target_paths: - - /daemon/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}_branch-${TRAVIS_BRANCH}$([ ! -z ${TRAVIS_TAG} ] && echo _tag-${TRAVIS_TAG})/mac/lbrynet + - /daemon/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}_branch-${TRAVIS_BRANCH}$([ ! -z ${TRAVIS_TAG} ] && echo _tag-${TRAVIS_TAG})/${OS}/lbrynet + + - <<: *build + name: "Mac" + os: osx + osx_image: xcode9.4 + language: generic + env: OS=mac cache: directories: diff --git a/lbrynet/wallet/ledger.py b/lbrynet/wallet/ledger.py index 8aab1248b..6f0422c88 100644 --- a/lbrynet/wallet/ledger.py +++ b/lbrynet/wallet/ledger.py @@ -90,13 +90,13 @@ class Headers(BaseHeaders): # Retarget bnPowLimit = _ArithUint256(self.ledger.max_target) - bnNew = _ArithUint256.SetCompact(last['bits']) + bnNew = _ArithUint256.set_compact(last['bits']) bnNew *= nModulatedTimespan bnNew //= nModulatedTimespan if bnNew > bnPowLimit: bnNew = bnPowLimit - return bnNew.GetCompact(), bnNew._value + return bnNew.get_compact(), bnNew._value class MainNetLedger(BaseLedger): diff --git a/lbrynet/wallet/manager.py b/lbrynet/wallet/manager.py index 434a341b1..85b31648d 100644 --- a/lbrynet/wallet/manager.py +++ b/lbrynet/wallet/manager.py @@ -3,16 +3,16 @@ import json from binascii import hexlify from twisted.internet import defer -from torba.manager import WalletManager as BaseWalletManager +from torba.basemanager import BaseWalletManager from lbryschema.uri import parse_lbry_uri from lbryschema.error import URIParseError from lbryschema.claim import ClaimDict -from .ledger import MainNetLedger # pylint: disable=unused-import +from .ledger import MainNetLedger from .account import generate_certificate from .transaction import Transaction -from .database import WalletDatabase # pylint: disable=unused-import +from .database import WalletDatabase class BackwardsCompatibleNetwork: @@ -31,11 +31,11 @@ class BackwardsCompatibleNetwork: class LbryWalletManager(BaseWalletManager): @property - def ledger(self): # type: () -> MainNetLedger + def ledger(self) -> MainNetLedger: return self.default_account.ledger @property - def db(self): # type: () -> WalletDatabase + def db(self) -> WalletDatabase: return self.ledger.db @property