Skip to content
Snippets Groups Projects
Commit 168517de authored by inso's avatar inso
Browse files

Merge branch 'sakia020'

parents 72ffa0b5 d56e8958
Branches
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ environment: ...@@ -11,7 +11,7 @@ environment:
PYTHON_ARCH: "64" PYTHON_ARCH: "64"
CONDA_PY: "35" CONDA_PY: "35"
CONDA_NPY: "18" CONDA_NPY: "18"
QTDIR: "C:\\Qt\\5.6\\msvc2015_64" QTDIR: "C:\\Qt\\5.7\\msvc2015_64"
platform: x64 platform: x64
- PYTHON: "C:\\Python35_32" - PYTHON: "C:\\Python35_32"
...@@ -19,7 +19,7 @@ environment: ...@@ -19,7 +19,7 @@ environment:
PYTHON_ARCH: "32" PYTHON_ARCH: "32"
CONDA_PY: "35" CONDA_PY: "35"
CONDA_NPY: "18" CONDA_NPY: "18"
QTDIR: "C:\\Qt\\5.6\\msvc2015" QTDIR: "C:\\Qt\\5.7\\msvc2015"
platform: x86 platform: x86
install: install:
...@@ -36,7 +36,7 @@ install: ...@@ -36,7 +36,7 @@ install:
#- choco install -y vcredist2015 #- choco install -y vcredist2015
- "%CMD_IN_ENV% conda config --set always_yes yes --set changeps1 no" - "%CMD_IN_ENV% conda config --set always_yes yes --set changeps1 no"
- "%CMD_IN_ENV% conda config --add channels inso/channel/sakia" - "%CMD_IN_ENV% conda config --add channels inso/channel/sakia"
- "%CMD_IN_ENV% conda create -q -n test-environment python=%PYTHON_VERSION% pyqt5=5.6 libsodium=1.0.3 setuptools=19.2" - "%CMD_IN_ENV% conda create -q -n test-environment python=%PYTHON_VERSION% libsodium=1.0.3 setuptools=19.2"
cache: cache:
- C:\Qt\5.6\5.6 - C:\Qt\5.6\5.6
......
...@@ -11,6 +11,7 @@ pyrcc5 -version ...@@ -11,6 +11,7 @@ pyrcc5 -version
lrelease -version lrelease -version
pip install PyQt5
pip install -r requirements.txt pip install -r requirements.txt
pip install pyinstaller pip install pyinstaller
pip install six pip install six
......
...@@ -15,8 +15,8 @@ then ...@@ -15,8 +15,8 @@ then
brew update brew update
brew install libsodium brew install libsodium
## Ensure your brew QT version is up to date. (brew install qt -> qt 4.8) ## Ensure your brew QT version is up to date. (brew install qt -> qt 4.8)
brew install qt55 brew install qt57
brew link --force qt55 brew link --force qt57
brew install pyenv-virtualenv brew install pyenv-virtualenv
pyenv update pyenv update
elif [ $TRAVIS_OS_NAME == "linux" ] elif [ $TRAVIS_OS_NAME == "linux" ]
...@@ -27,9 +27,9 @@ then ...@@ -27,9 +27,9 @@ then
libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 \ libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 \
libxcb-render-util0-dev libxcb-glx0-dev libgl1-mesa-dri libegl1-mesa libpcre3-dev \ libxcb-render-util0-dev libxcb-glx0-dev libgl1-mesa-dri libegl1-mesa libpcre3-dev \
curl libdbus-1-dev libdbus-glib-1-dev autoconf automake libtool libgstreamer-plugins-base0.10-0 curl libdbus-1-dev libdbus-glib-1-dev autoconf automake libtool libgstreamer-plugins-base0.10-0
wget https://download.qt.io/official_releases/qt/5.5/5.5.1/qt-opensource-linux-x64-5.5.1.run wget https://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-linux-x64-5.7.0.run
chmod +x qt-opensource-linux-x64-5.5.1.run chmod +x qt-opensource-linux-x64-5.7.0.run
./qt-opensource-linux-x64-5.5.1.run --script $HOME/build/duniter/sakia/ci/travis/qt-installer-noninteractive.qs ./qt-opensource-linux-x64-5.7.0.run --script $HOME/build/duniter/sakia/ci/travis/qt-installer-noninteractive.qs
wget http://archive.ubuntu.com/ubuntu/pool/universe/libs/libsodium/libsodium13_1.0.1-1_amd64.deb wget http://archive.ubuntu.com/ubuntu/pool/universe/libs/libsodium/libsodium13_1.0.1-1_amd64.deb
sudo dpkg -i libsodium13_1.0.1-1_amd64.deb sudo dpkg -i libsodium13_1.0.1-1_amd64.deb
...@@ -54,53 +54,7 @@ fi ...@@ -54,53 +54,7 @@ fi
pyenv shell $PYENV_PYTHON_VERSION pyenv shell $PYENV_PYTHON_VERSION
cd $HOME pip install PyQt5
wget http://ufpr.dl.sourceforge.net/project/pyqt/sip/sip-4.17/sip-4.17.tar.gz
file sip-4.17.tar.gz
gzip -t sip-4.17.tar.gz
tar xzf sip-4.17.tar.gz
cd sip-4.17/
python configure.py
make && make install
pyenv rehash
cd $HOME
pyenv shell $PYENV_PYTHON_VERSION
wget http://ufpr.dl.sourceforge.net/project/pyqt/PyQt5/PyQt-5.5.1/PyQt-gpl-5.5.1.tar.gz
file PyQt-gpl-5.5.1.tar.gz
gzip -t PyQt-gpl-5.5.1.tar.gz
tar xzf PyQt-gpl-5.5.1.tar.gz
cd PyQt-gpl-5.5.1/
if [ $TRAVIS_OS_NAME == "osx" ]
then
python configure.py --confirm-license \
--enable QtCore \
--enable QtWidgets \
--enable QtGui \
--enable QtSvg \
--enable QtWebChannel \
--enable QtWebEngineWidgets \
--enable QtNetwork \
--enable QtPrintSupport \
--enable QtTest \
--pyuic5-interpreter /Users/travis/.pyenv/versions/$PYENV_PYTHON_VERSION/bin/python3.5 \
--sip /Users/travis/.pyenv/versions/$PYENV_PYTHON_VERSION/Python.framework/Versions/3.5/bin/sip
elif [ $TRAVIS_OS_NAME == "linux" ]
then
python configure.py --qmake "/tmp/qt/5.5/5.5/gcc_64/bin/qmake" --confirm-license \
--enable QtCore \
--enable QtWidgets \
--enable QtGui \
--enable QtSvg \
--enable QtWebChannel \
--enable QtWebEngineWidgets \
--enable QtNetwork \
--enable QtPrintSupport \
--enable QtTest \
--pyuic5-interpreter /home/travis/.pyenv/versions/$PYENV_PYTHON_VERSION/bin/python3.5 \
--sip /home/travis/.pyenv/versions/3.5.2/bin/sip
fi
make -j 2 && make install make -j 2 && make install
pyenv rehash pyenv rehash
...@@ -15,7 +15,7 @@ then ...@@ -15,7 +15,7 @@ then
pip install -U git+https://github.com/posborne/dbus-python.git pip install -U git+https://github.com/posborne/dbus-python.git
pip install notify2 pip install notify2
export PATH=/tmp/qt/5.5/5.5/gcc_64/bin:$PATH export PATH=/tmp/qt/5.7/5.7/gcc_64/bin:$PATH
fi fi
if [ $TRAVIS_OS_NAME == "osx" ] if [ $TRAVIS_OS_NAME == "osx" ]
then then
......
...@@ -21,7 +21,7 @@ Controller.prototype.IntroductionPageCallback = function() { ...@@ -21,7 +21,7 @@ Controller.prototype.IntroductionPageCallback = function() {
Controller.prototype.TargetDirectoryPageCallback = function() Controller.prototype.TargetDirectoryPageCallback = function()
{ {
gui.currentPageWidget().TargetDirectoryLineEdit.setText("/tmp/qt/5.5"); gui.currentPageWidget().TargetDirectoryLineEdit.setText("/tmp/qt/5.7");
gui.clickButton(buttons.NextButton); gui.clickButton(buttons.NextButton);
} }
......
...@@ -169,7 +169,6 @@ class Community(QObject): ...@@ -169,7 +169,6 @@ class Community(QObject):
else: else:
return None return None
except errors.DuniterError as e: except errors.DuniterError as e:
if e.ucode == errors.BLOCK_NOT_FOUND:
logging.debug(str(e)) logging.debug(str(e))
return None return None
except NoPeerAvailable as e: except NoPeerAvailable as e:
...@@ -225,7 +224,7 @@ class Community(QObject): ...@@ -225,7 +224,7 @@ class Community(QObject):
req_args={'number': block_number}) req_args={'number': block_number})
return block['medianTime'] return block['medianTime']
except errors.DuniterError as e: except errors.DuniterError as e:
if e.ucode == errors.BLOCK_NOT_FOUND: logging.debug(str(e))
return 0 return 0
except NoPeerAvailable as e: except NoPeerAvailable as e:
logging.debug(str(e)) logging.debug(str(e))
......
...@@ -96,6 +96,13 @@ class RelativeToPast(BaseReferential): ...@@ -96,6 +96,13 @@ class RelativeToPast(BaseReferential):
from . import Relative from . import Relative
value = await self.differential() value = await self.differential()
block = await self.community.get_ud_block(0, self._block_number) block = await self.community.get_ud_block(0, self._block_number)
if block:
date = QLocale.toString(
QLocale(),
QDateTime.fromTime_t(block['medianTime']).date(),
QLocale.dateFormat(QLocale(), QLocale.ShortFormat))
else:
date = "###"
prefix = "" prefix = ""
if international_system and value != 0: if international_system and value != 0:
localized_value, prefix = Relative.to_si(value, self.app.preferences['digits_after_comma']) localized_value, prefix = Relative.to_si(value, self.app.preferences['digits_after_comma'])
...@@ -104,13 +111,7 @@ class RelativeToPast(BaseReferential): ...@@ -104,13 +111,7 @@ class RelativeToPast(BaseReferential):
if units or international_system: if units or international_system:
return QCoreApplication.translate("RelativeToPast", RelativeToPast._REF_STR_)\ return QCoreApplication.translate("RelativeToPast", RelativeToPast._REF_STR_)\
.format(localized_value, .format(localized_value,prefix,date,
prefix,
QLocale.toString(
QLocale(),
QDateTime.fromTime_t(block['medianTime']).date(),
QLocale.dateFormat(QLocale(), QLocale.ShortFormat)
),
self.community.short_currency if units else "") self.community.short_currency if units else "")
else: else:
return localized_value return localized_value
...@@ -190,6 +190,7 @@ class Wallet(QObject): ...@@ -190,6 +190,7 @@ class Wallet(QObject):
amount, amount_base = reduce_base(amount, 0) amount, amount_base = reduce_base(amount, 0)
cache = self.caches[community.currency] cache = self.caches[community.currency]
if cache.available_sources:
current_base = max([src['base'] for src in cache.available_sources]) current_base = max([src['base'] for src in cache.available_sources])
value = 0 value = 0
sources = [] sources = []
...@@ -303,7 +304,7 @@ class Wallet(QObject): ...@@ -303,7 +304,7 @@ class Wallet(QObject):
unlocks = self.tx_unlocks(sources) unlocks = self.tx_unlocks(sources)
outputs = self.tx_outputs(pubkey, computed_outputs, overheads) outputs = self.tx_outputs(pubkey, computed_outputs, overheads)
logging.debug("Outputs : {0}".format(outputs)) logging.debug("Outputs : {0}".format(outputs))
tx = Transaction(PROTOCOL_VERSION, community.currency, blockstamp, 0, tx = Transaction(3, community.currency, blockstamp, 0,
[self.pubkey], inputs, unlocks, [self.pubkey], inputs, unlocks,
outputs, message, None) outputs, message, None)
return tx return tx
......
...@@ -64,6 +64,7 @@ class TestWallet(unittest.TestCase, QuamashTest): ...@@ -64,6 +64,7 @@ class TestWallet(unittest.TestCase, QuamashTest):
tx = wallet.prepare_tx("FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn", tx = wallet.prepare_tx("FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn",
BlockUID(32, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8"), BlockUID(32, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8"),
99, "", community) 99, "", community)
self.assertEqual(tx.version, 3)
self.assertEqual(tx.blockstamp.number, 32) self.assertEqual(tx.blockstamp.number, 32)
self.assertEqual(tx.blockstamp.sha_hash, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8") self.assertEqual(tx.blockstamp.sha_hash, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8")
self.assertEqual(len(tx.issuers), 1) self.assertEqual(len(tx.issuers), 1)
...@@ -89,22 +90,6 @@ class TestWallet(unittest.TestCase, QuamashTest): ...@@ -89,22 +90,6 @@ class TestWallet(unittest.TestCase, QuamashTest):
self.assertEqual(tx.unlocks[0].parameters[0].index, 0) self.assertEqual(tx.unlocks[0].parameters[0].index, 0)
self.assertEqual(tx.unlocks[1].index, 1) self.assertEqual(tx.unlocks[1].index, 1)
self.assertEqual(tx.unlocks[0].parameters[0].index, 0) self.assertEqual(tx.unlocks[0].parameters[0].index, 0)
self.assertEqual(tx.raw(), """Version: 2
Type: Transaction
Currency: test_currency
Locktime: 0
Issuers:
7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ
Inputs:
D:FCAD5A388AC8A811B45A9334A375585E77071AA9F6E5B6896582961A6C66F365:2
D:A0AC57E2E4B24D66F2D25E66D8501D8E881D9E6453D1789ED753D7D426537ED5:4
Unlocks:
0:SIG(0)
1:SIG(0)
Outputs:
99:0:SIG(FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn)
1:0:SIG(7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ)
Comment:""" + " \n")
def test_prepare_tx_base_1(self): def test_prepare_tx_base_1(self):
community = MagicMock("sakia.core.Community") community = MagicMock("sakia.core.Community")
...@@ -140,6 +125,7 @@ Comment:""" + " \n") ...@@ -140,6 +125,7 @@ Comment:""" + " \n")
tx = wallet.prepare_tx("FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn", tx = wallet.prepare_tx("FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn",
BlockUID(32, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8"), BlockUID(32, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8"),
100, "", community) 100, "", community)
self.assertEqual(tx.version, 3)
self.assertEqual(tx.blockstamp.number, 32) self.assertEqual(tx.blockstamp.number, 32)
self.assertEqual(tx.blockstamp.sha_hash, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8") self.assertEqual(tx.blockstamp.sha_hash, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8")
self.assertEqual(len(tx.issuers), 1) self.assertEqual(len(tx.issuers), 1)
...@@ -160,20 +146,6 @@ Comment:""" + " \n") ...@@ -160,20 +146,6 @@ Comment:""" + " \n")
self.assertEqual(len(tx.unlocks), 1) self.assertEqual(len(tx.unlocks), 1)
self.assertEqual(tx.unlocks[0].index, 0) self.assertEqual(tx.unlocks[0].index, 0)
self.assertEqual(tx.unlocks[0].parameters[0].index, 0) self.assertEqual(tx.unlocks[0].parameters[0].index, 0)
self.assertEqual(tx.raw(), """Version: 2
Type: Transaction
Currency: test_currency
Locktime: 0
Issuers:
7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ
Inputs:
T:7518C700E78B56CC21FB1DDC6CBAB24E0FACC9A798F5ED8736EA007F38617D67:4
Unlocks:
0:SIG(0)
Outputs:
10:1:SIG(FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn)
1:1:SIG(7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ)
Comment:""" + " \n")
def test_prepare_tx_base_1_overheads(self): def test_prepare_tx_base_1_overheads(self):
community = MagicMock("sakia.core.Community") community = MagicMock("sakia.core.Community")
...@@ -209,6 +181,7 @@ Comment:""" + " \n") ...@@ -209,6 +181,7 @@ Comment:""" + " \n")
tx = wallet.prepare_tx("FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn", tx = wallet.prepare_tx("FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn",
BlockUID(32, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8"), BlockUID(32, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8"),
101, "", community) 101, "", community)
self.assertEqual(tx.version, 3)
self.assertEqual(tx.blockstamp.number, 32) self.assertEqual(tx.blockstamp.number, 32)
self.assertEqual(tx.blockstamp.sha_hash, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8") self.assertEqual(tx.blockstamp.sha_hash, "000005E0F228038E4DDD4F6CA4ACB01EC88FBAF8")
self.assertEqual(len(tx.issuers), 1) self.assertEqual(len(tx.issuers), 1)
...@@ -242,21 +215,3 @@ Comment:""" + " \n") ...@@ -242,21 +215,3 @@ Comment:""" + " \n")
self.assertEqual(tx.unlocks[0].parameters[0].index, 0) self.assertEqual(tx.unlocks[0].parameters[0].index, 0)
self.assertEqual(tx.unlocks[1].index, 1) self.assertEqual(tx.unlocks[1].index, 1)
self.assertEqual(tx.unlocks[1].parameters[0].index, 0) self.assertEqual(tx.unlocks[1].parameters[0].index, 0)
self.assertEqual(tx.raw(), """Version: 2
Type: Transaction
Currency: test_currency
Locktime: 0
Issuers:
7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ
Inputs:
T:7518C700E78B56CC21FB1DDC6CBAB24E0FACC9A798F5ED8736EA007F38617D67:4
D:FCAD5A388AC8A811B45A9334A375585E77071AA9F6E5B6896582961A6C66F365:2
Unlocks:
0:SIG(0)
1:SIG(0)
Outputs:
1:0:SIG(FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn)
10:1:SIG(FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn)
14:0:SIG(7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ)
1:1:SIG(7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ)
Comment:""" + " \n")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment