Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • appimage
  • check_uniq_node_by_endpoints
  • dev
  • feature/agent_architecture
  • feature/backend
  • fix_ci
  • fix_ci_osx
  • fix_dbus_error
  • fix_gitlab
  • fix_travis#1105
  • fixappveyor
  • gitlab
  • landscape
  • master
  • pyinstaller
  • pyqt5.6
  • qt5.7
  • qtwebengine
  • sakia020
  • translations
  • 0.1.0
  • 0.10.0
  • 0.10.1
  • 0.10.2
  • 0.11.0
  • 0.11.1
  • 0.11.2
  • 0.11.3
  • 0.11.4
  • 0.11.4.post1
  • 0.11.5
  • 0.12.0
  • 0.12.1dev1
  • 0.12.1dev2
  • 0.12.1dev3
  • 0.12.1dev4
  • 0.12.dev1
  • 0.12.dev2
  • 0.12.dev3
  • 0.12.dev4
  • 0.12.dev5
  • 0.12rc1
  • 0.2.0
  • 0.2.1
  • 0.20.0
  • 0.20.0dev1
  • 0.20.0dev10
  • 0.20.0dev12
  • 0.20.0dev13
  • 0.20.0dev14
  • 0.20.0dev15
  • 0.20.0dev16
  • 0.20.0dev2
  • 0.20.0dev3
  • 0.20.0dev3-test1
  • 0.20.0dev4
  • 0.20.0dev5
  • 0.20.0dev6
  • 0.20.0dev7
  • 0.20.0dev8
  • 0.20.0dev9
  • 0.20.1
  • 0.20.10
  • 0.20.11
  • 0.20.13
  • 0.20.2
  • 0.20.3
  • 0.20.4
  • 0.20.5
  • 0.20.6
  • 0.20.7
  • 0.20.8
  • 0.20.9
  • 0.3.0
  • 0.30.0
  • 0.30.0beta
  • 0.30.0beta1
  • 0.30.0beta2
  • 0.30.0beta3
  • 0.30.0beta4
  • 0.30.0beta5
  • 0.30.0beta6
  • 0.30.0beta7
  • 0.30.0beta8
  • 0.30.0beta9
  • 0.30.1
  • 0.30.10
  • 0.30.11
  • 0.30.12
  • 0.30.13
  • 0.30.14
  • 0.30.2
  • 0.30.3
  • 0.30.4
  • 0.30.5
  • 0.30.6
  • 0.30.7
  • 0.30.8
  • 0.30.9
  • 0.31.0
  • 0.31.0.post1
  • 0.31.1
  • 0.31.2
  • 0.31.3
  • 0.31.4
  • 0.31.5
  • 0.31.6
  • 0.32.0
  • 0.32.0-linux
  • 0.32.0RC1
  • 0.32.0RC2
  • 0.32.0RC3
  • 0.32.0RC4
  • 0.32.0RC5
  • 0.32.0RC6
  • 0.32.1
  • 0.32.10
  • 0.32.10post1
  • 0.32.2
  • 0.32.3
120 results

Target

Select target project
  • cebash/sakia
  • santiago/sakia
  • jonas/sakia
3 results
Select Git revision
  • Docker
  • Docker-debian9
  • check_uniq_node_by_endpoints
  • dev
  • feature/agent_architecture
  • feature/backend
  • fix_ci
  • fix_ci_osx
  • fix_dbus_error
  • fix_travis#1105
  • fixappveyor
  • gitlab
  • landscape
  • master
  • pyinstaller
  • pyqt5.6
  • qt5.7
  • qtwebengine
  • sakia020
  • translations
  • 0.1.0
  • 0.10.0
  • 0.10.1
  • 0.10.2
  • 0.11.0
  • 0.11.1
  • 0.11.2
  • 0.11.3
  • 0.11.4
  • 0.11.4.post1
  • 0.11.5
  • 0.12.0
  • 0.12.1dev1
  • 0.12.1dev2
  • 0.12.1dev3
  • 0.12.1dev4
  • 0.12.dev1
  • 0.12.dev2
  • 0.12.dev3
  • 0.12.dev4
  • 0.12.dev5
  • 0.12rc1
  • 0.2.0
  • 0.2.1
  • 0.20.0
  • 0.20.0dev1
  • 0.20.0dev10
  • 0.20.0dev12
  • 0.20.0dev13
  • 0.20.0dev14
  • 0.20.0dev15
  • 0.20.0dev16
  • 0.20.0dev2
  • 0.20.0dev3
  • 0.20.0dev3-test1
  • 0.20.0dev4
  • 0.20.0dev5
  • 0.20.0dev6
  • 0.20.0dev7
  • 0.20.0dev8
  • 0.20.0dev9
  • 0.20.1
  • 0.20.10
  • 0.20.11
  • 0.20.13
  • 0.20.2
  • 0.20.3
  • 0.20.4
  • 0.20.5
  • 0.20.6
  • 0.20.7
  • 0.20.8
  • 0.20.9
  • 0.3.0
  • 0.30.0
  • 0.30.0beta
  • 0.30.0beta1
  • 0.30.0beta2
  • 0.30.0beta3
  • 0.30.0beta4
  • 0.30.0beta5
  • 0.30.0beta6
  • 0.30.0beta7
  • 0.30.0beta8
  • 0.30.0beta9
  • 0.30.1
  • 0.30.10
  • 0.30.11
  • 0.30.12
  • 0.30.13
  • 0.30.14
  • 0.30.2
  • 0.30.3
  • 0.30.4
  • 0.30.5
  • 0.30.6
  • 0.30.7
  • 0.30.8
  • 0.30.9
  • 0.31.0
  • 0.31.0.post1
  • 0.31.1
  • 0.31.2
  • 0.31.3
  • 0.31.4
  • 0.31.5
  • 0.31.6
  • 0.32.0
  • 0.32.0-linux
  • 0.32.0RC1
  • 0.32.0RC2
  • 0.32.0RC3
  • 0.32.0RC4
  • 0.32.0RC5
  • 0.32.0RC6
  • 0.32.1
  • 0.32.10
  • 0.32.10post1
  • 0.32.2
  • 0.32.3
120 results
Show changes
Showing
with 11070 additions and 21550 deletions
#!/bin/bash
#__version_info__ = ('0', '20', '0dev6')
current=`grep -P "__version_info__ = \(\'\d+\', \'\d+\', \'\d+(\w*)\'\)" src/sakia/__init__.py | grep -oP "\'\d+\', \'\d+\', \'\d+(\w*)\'"`
current=`grep -P "__version_info__ = \(\"\d+\", \"\d+\", \"\d+(\w*)\"\)" src/sakia/__init__.py | grep -oP "\"\d+\", \"\d+\", \"\d+(\w*)\""`
echo "Current version: $current"
if [[ $1 =~ ^[0-9]+.[0-9]+.[0-9]+[0-9A-Za-z]*$ ]]; then
IFS='.' read -r -a array <<< "$1"
sed -i "s/__version_info__\ = ($current)/__version_info__ = ('${array[0]}', '${array[1]}', '${array[2]}')/g" src/sakia/__init__.py
sed -i "s/__version_info__\ = ($current)/__version_info__ = (\"${array[0]}\", \"${array[1]}\", \"${array[2]}\")/g" src/sakia/__init__.py
sed -i "s/#define MyAppVerStr .*/#define MyAppVerStr \"$1\"/g" ci/appveyor/sakia.iss
sed -i "s/Version: .*/Version: $1/g" ci/travis/debian/DEBIAN/control
sed -i "s/Version=.*/Version=$1/g" res/linux/usr/share/applications/sakia.desktop
git commit src/sakia/__init__.py ci/appveyor/sakia.iss ci/travis/debian/DEBIAN/control res/linux/usr/share/applications/sakia.desktop -m "$1"
sed -i "s/version=.*/version=$1/g" ci/appimage/config.env
git commit src/sakia/__init__.py ci/appveyor/sakia.iss ci/travis/debian/DEBIAN/control res/linux/usr/share/applications/sakia.desktop ci/appimage/config.env -m "$1"
git tag "$1" -a -m "$1"
else
echo "Wrong version format"
......
quamash
asynctest
networkx
attrs
duniter-mirage
duniterpy>=0.40
pytest
pytest-asyncio<0.6
pyyaml
aiohttp
async_timeout
PyQt5>=5.9,<5.10
\ No newline at end of file
pypeg2
aiohttp==3.6.2
async-timeout==3.0.1
attrs==19.3.0
duniterpy==0.58.1
jsonschema==3.2.0
networkx==2.4
PyQt5==5.9.2
PyYAML==5.3
Quamash==0.6.1
setuptools>=46.0.0
wheel
twine
\ No newline at end of file
black==20.8b1
duniter-mirage>=0.1.50
mypy==0.770
pylint==2.4.4
pytest
pytest-asyncio
md-to-html
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
[Desktop Entry]
Version=0.32.10post1
Version=0.53.2
Name=Sakia
Comment=Duniter Qt Client
Exec=sakia
......
......@@ -81,7 +81,7 @@ else:
debug=True,
strip=False,
upx=True,
console=True,
console=False,
icon='sakia.ico')
......
from setuptools import setup, find_packages
import os
import re
import subprocess
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'src')))
import sakia
......@@ -26,11 +27,22 @@ def which(program):
return None
path = os.path.abspath(os.path.join(os.path.dirname(__file__)))
subprocess.call(
"python {0}/gen_resources.py".format(path), shell=True
)
subprocess.call(
"python {0}/gen_translations.py".format(path), shell=True
)
EDITABLE_REQUIREMENT = re.compile(r'^-e (?P<link>(?P<vcs>git|svn|hg|bzr).+#egg=(?P<package>.+)-(?P<version>\d(?:\.\d)*))$')
install_requires = []
dependency_links = []
data_files = [('sakia', ['src/sakia/root_servers.yml', 'src/sakia/g1_licence.html'])]
data_files = [('sakia', ['src/sakia/root_servers.yml', 'src/sakia/g1_license.html'])]
for requirement in (l.strip() for l in open('requirements.txt')):
match = EDITABLE_REQUIREMENT.match(requirement)
......@@ -61,6 +73,7 @@ setup(
description="A [duniter](https://github.com/duniter/duniter) Python client",
long_description=open('README.md').read(),
long_description_content_type="text/markdown",
# Active la prise en compte du fichier MANIFEST.in
include_package_data=True,
......
__version_info__ = ('0', '32', '10post1')
__version__ = '.'.join(__version_info__)
__version_info__ = ("0", "53", "2")
__version__ = ".".join(__version_info__)
import os
import shutil
import attr
import datetime
import logging
import socket
import yaml
import sakia.i18n_rc
import async_timeout
import aiohttp
from PyQt5.QtCore import QObject, pyqtSignal, QTranslator, QCoreApplication, QLocale, Qt
from PyQt5.QtCore import (
QObject,
pyqtSignal,
QTranslator,
QCoreApplication,
QLocale,
Qt,
QFile,
)
from . import __version__
from .options import SakiaOptions
from sakia.constants import GITLAB_RELEASES_API_URL, GITLAB_RELEASES_PAGE_URL
from sakia.options import SakiaOptions
from sakia.data.connectors import BmaConnector
from sakia.services import NetworkService, BlockchainService, IdentitiesService, \
SourcesServices, TransactionsService, DocumentsService
from sakia.services import (
NetworkService,
BlockchainService,
IdentitiesService,
SourcesServices,
TransactionsService,
DocumentsService,
)
from sakia.data.repositories import SakiaDatabase
from sakia.data.entities import Transaction, Connection, Identity, Dividend
from sakia.data.processors import BlockchainProcessor, NodesProcessor, IdentitiesProcessor, \
CertificationsProcessor, SourcesProcessor, TransactionsProcessor, ConnectionsProcessor, DividendsProcessor
from sakia.data.processors import (
BlockchainProcessor,
NodesProcessor,
IdentitiesProcessor,
CertificationsProcessor,
SourcesProcessor,
TransactionsProcessor,
ConnectionsProcessor,
DividendsProcessor,
)
from sakia.data.files import AppDataFile, UserParametersFile, PluginsDirectory
from sakia.decorators import asyncify
from sakia.money import *
......@@ -61,10 +90,11 @@ class Application(QObject):
loop = attr.ib()
options = attr.ib()
app_data = attr.ib()
parameters = attr.ib()
db = attr.ib()
currency = attr.ib()
plugins_dir = attr.ib()
root_servers = attr.ib(default=None)
parameters = attr.ib(default=None)
db = attr.ib(default=None)
currency = attr.ib(default=None)
plugins_dir = attr.ib(default=None)
network_service = attr.ib(default=None)
blockchain_service = attr.ib(default=None)
identities_service = attr.ib(default=None)
......@@ -72,9 +102,10 @@ class Application(QObject):
transactions_service = attr.ib(default=None)
documents_service = attr.ib(default=None)
current_ref = attr.ib(default=Quantitative)
_logger = attr.ib(default=attr.Factory(lambda:logging.getLogger('sakia')))
_logger = attr.ib(default=attr.Factory(lambda: logging.getLogger("sakia")))
available_version = attr.ib(init=False)
_translator = attr.ib(init=False)
_qt_translator = attr.ib(init=False)
def __attrs_post_init__(self):
super().__init__()
......@@ -86,21 +117,56 @@ class Application(QObject):
qapp.setAttribute(Qt.AA_EnableHighDpiScaling, True)
options = SakiaOptions.from_arguments(argv)
app_data = AppDataFile.in_config_path(options.config_path).load_or_init()
app = cls(qapp, loop, options, app_data, None, None, options.currency, None)
app = cls(
qapp, loop, options, app_data, None, None, None, options.currency, None
)
app.load_root_servers()
# app.set_proxy()
app.load_profile(options.profile)
app.documents_service = DocumentsService.instanciate(app)
app.switch_language()
return app
def load_root_servers(self):
"""
Load root servers config
:return:
"""
filename = "root_servers.yml"
root_servers_default_path = os.path.join(os.path.dirname(__file__), filename)
root_servers_config_path = os.path.join(self.options.config_path, filename)
self._logger.debug(
"Check root servers config file: {}...".format(root_servers_config_path)
)
if not os.path.exists(root_servers_config_path):
self._logger.debug(
"Create root servers config file: {}".format(root_servers_config_path)
)
shutil.copy(root_servers_default_path, root_servers_config_path)
self._logger.debug(
"Load root servers config file: {}".format(root_servers_config_path)
)
with open(
root_servers_config_path,
"r",
encoding="utf-8",
) as stream:
self.root_servers = yaml.load(stream, Loader=yaml.FullLoader)
def load_profile(self, profile_name):
"""
Initialize databases depending on profile loaded
:param profile_name:
:return:
"""
self.plugins_dir = PluginsDirectory.in_config_path(self.options.config_path, profile_name).load_or_init(self.options.with_plugin)
self.parameters = UserParametersFile.in_config_path(self.options.config_path, profile_name).load_or_init(profile_name)
self.plugins_dir = PluginsDirectory.in_config_path(
self.options.config_path, profile_name
).load_or_init(self.options.with_plugin)
self.parameters = UserParametersFile.in_config_path(
self.options.config_path, profile_name
).load_or_init(profile_name)
self.db = SakiaDatabase.load_or_init(self.options, profile_name)
self.instanciate_services()
......@@ -109,52 +175,87 @@ class Application(QObject):
nodes_processor = NodesProcessor(self.db.nodes_repo)
bma_connector = BmaConnector(nodes_processor, self.parameters)
connections_processor = ConnectionsProcessor(self.db.connections_repo)
identities_processor = IdentitiesProcessor(self.db.identities_repo, self.db.certifications_repo, self.db.blockchains_repo, bma_connector)
certs_processor = CertificationsProcessor(self.db.certifications_repo, self.db.identities_repo, bma_connector)
identities_processor = IdentitiesProcessor(
self.db.identities_repo,
self.db.certifications_repo,
self.db.blockchains_repo,
bma_connector,
)
certs_processor = CertificationsProcessor(
self.db.certifications_repo, self.db.identities_repo, bma_connector
)
blockchain_processor = BlockchainProcessor.instanciate(self)
sources_processor = SourcesProcessor.instanciate(self)
transactions_processor = TransactionsProcessor.instanciate(self)
dividends_processor = DividendsProcessor.instanciate(self)
nodes_processor.initialize_root_nodes(self.currency)
nodes_processor.initialize_root_nodes(self.currency, self.root_servers)
self.db.commit()
self.documents_service = DocumentsService.instanciate(self)
self.identities_service = IdentitiesService(self.currency, connections_processor,
self.identities_service = IdentitiesService(
self.currency,
connections_processor,
identities_processor,
certs_processor, blockchain_processor,
bma_connector)
certs_processor,
blockchain_processor,
bma_connector,
)
self.transactions_service = TransactionsService(self.currency, transactions_processor,
self.transactions_service = TransactionsService(
self.currency,
transactions_processor,
dividends_processor,
identities_processor, connections_processor,
bma_connector)
identities_processor,
connections_processor,
bma_connector,
)
self.sources_service = SourcesServices(self.currency, sources_processor,
connections_processor, transactions_processor,
blockchain_processor, bma_connector)
self.sources_service = SourcesServices(
self.currency,
sources_processor,
connections_processor,
transactions_processor,
blockchain_processor,
bma_connector,
)
self.blockchain_service = BlockchainService(self, self.currency, blockchain_processor, connections_processor,
self.blockchain_service = BlockchainService(
self,
self.currency,
blockchain_processor,
connections_processor,
bma_connector,
self.identities_service,
self.transactions_service,
self.sources_service)
self.sources_service,
)
self.network_service = NetworkService.load(self, self.currency, nodes_processor,
self.network_service = NetworkService.load(
self,
self.currency,
nodes_processor,
self.blockchain_service,
self.identities_service)
self.identities_service,
)
async def remove_connection(self, connection):
connections_processor = ConnectionsProcessor.instanciate(self)
connections_processor.remove_connections(connection)
CertificationsProcessor.instanciate(self).cleanup_connection(connection, connections_processor.pubkeys())
CertificationsProcessor.instanciate(self).cleanup_connection(
connection, connections_processor.pubkeys()
)
IdentitiesProcessor.instanciate(self).cleanup_connection(connection)
SourcesProcessor.instanciate(self).drop_all_of(currency=connection.currency, pubkey=connection.pubkey)
SourcesProcessor.instanciate(self).drop_all_of(
currency=connection.currency, pubkey=connection.pubkey
)
DividendsProcessor.instanciate(self).cleanup_connection(connection)
TransactionsProcessor.instanciate(self).cleanup_connection(connection, connections_processor.pubkeys())
TransactionsProcessor.instanciate(self).cleanup_connection(
connection, connections_processor.pubkeys()
)
self.db.commit()
self.connection_removed.emit(connection)
......@@ -171,13 +272,26 @@ class Application(QObject):
self._translator = QTranslator(self.qapp)
if locale == "en":
QCoreApplication.installTranslator(self._translator)
elif self._translator.load(":/i18n/{0}".format(locale)):
else:
# load chosen language
filepath = ":/i18n/{0}".format(locale)
if not QFile.exists(filepath):
self._logger.debug("File not found: {0}".format(filepath))
self._translator.load(filepath)
if QCoreApplication.installTranslator(self._translator):
self._logger.debug("Loaded i18n/{0}".format(locale))
self._logger.debug("Loaded {0}".format(filepath))
else:
self._logger.debug("Couldn't load translation")
self._logger.debug("Couldn't load {0}".format(filepath))
# load standardButtons Qt translation
filepath = ":/i18n/qtbase_{0}".format(locale)
if not QFile.exists(filepath):
self._logger.debug("File not found: {0}".format(filepath))
self._qt_translator = QTranslator(self.qapp)
self._qt_translator.load(filepath)
if QCoreApplication.installTranslator(self._qt_translator):
self._logger.debug("Loaded {0}".format(filepath))
else:
self._logger.debug("Couldn't load i18n/{0}".format(locale))
self._logger.debug("Couldn't load {0}".format(filepath))
def start_coroutines(self):
self.network_service.start_coroutines()
......@@ -195,33 +309,36 @@ class Application(QObject):
try:
async with aiohttp.ClientSession() as session:
async with async_timeout.timeout(10):
response = await session.get("https://api.github.com/repos/duniter/sakia/releases",
proxy=self.parameters.proxy())
response = await session.get(
GITLAB_RELEASES_API_URL,
proxy=self.parameters.proxy(),
)
if response.status == 200:
releases = await response.json()
latest = None
for r in releases:
if not latest:
latest = r
else:
latest_date = datetime.datetime.strptime(latest['published_at'], "%Y-%m-%dT%H:%M:%SZ")
date = datetime.datetime.strptime(r['published_at'], "%Y-%m-%dT%H:%M:%SZ")
if latest_date < date:
latest = r
latest_version = latest["tag_name"]
version = (__version__ == latest_version,
if len(releases) > 0:
release = releases[0]
latest_version = release["tag_name"]
version = (
__version__ == latest_version,
latest_version,
latest["html_url"])
GITLAB_RELEASES_PAGE_URL,
)
logging.debug("Found version: {0}".format(latest_version))
logging.debug("Current version: {0}".format(__version__))
self.available_version = version
except (aiohttp.ClientError, aiohttp.ServerDisconnectedError, asyncio.TimeoutError, socket.gaierror) as e:
self._logger.debug("Could not connect to github : {0}".format(str(e)))
except (
aiohttp.ClientError,
aiohttp.ServerDisconnectedError,
asyncio.TimeoutError,
socket.gaierror,
) as e:
self._logger.debug("Could not connect to gitlab: {0}".format(str(e)))
def save_parameters(self, parameters):
self.parameters = UserParametersFile\
.in_config_path(self.options.config_path, parameters.profile_name)\
.save(parameters)
self.parameters = UserParametersFile.in_config_path(
self.options.config_path, parameters.profile_name
).save(parameters)
def change_referential(self, index):
self.current_ref = Referentials[index]
......
import os
import yaml
MAX_CONFIRMATIONS = 6
with open(os.path.join(os.path.dirname(__file__), "root_servers.yml"), 'r') as stream:
ROOT_SERVERS = yaml.load(stream)
with open(
os.path.join(os.path.dirname(__file__), "g1_license.html"), "r", encoding="utf-8"
) as stream:
G1_LICENSE = stream.read()
with open(os.path.join(os.path.dirname(__file__), "g1_licence.html"), 'r') as stream:
G1_LICENCE = stream.read()
GITLAB_RELEASES_PAGE_URL = "https://git.duniter.org/clients/python/sakia/-/releases"
GITLAB_RELEASES_API_URL = (
"https://git.duniter.org/api/v4/projects/clients%2Fpython%2Fsakia/releases"
)
GITLAB_NEW_ISSUE_PAGE_URL = "https://git.duniter.org/clients/python/sakia/-/issues/new"
This diff is collapsed.
This diff is collapsed.