Commit 516a9fa1 authored by inso's avatar inso

Change sakia packaging to be able to use wheels

parent 56532715
......@@ -41,6 +41,8 @@ nosetests.xml
src/sakia/gen_resources/*
src/icons_rc.py
src/i18n_rc.py
src/sakia/icons_rc.py
src/sakia/i18n_rc.py
res/i18n/qm
res/i18n/lang-*
out
......
......@@ -5,7 +5,7 @@ import sys, os, multiprocessing, subprocess
root_path = os.path.abspath(os.path.join(os.path.dirname(__file__)))
resources = os.path.abspath(os.path.join(os.path.dirname(__file__), 'res'))
gen_resources = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))
gen_resources = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src/sakia'))
def convert_ui(args, **kwargs):
subprocess.call(args, **kwargs)
......@@ -22,7 +22,10 @@ def build_resources():
exe = 'pyuic5'
elif f.endswith('.qrc'):
source = os.path.join(root, f)
dest = os.path.join(gen_resources, os.path.splitext(os.path.basename(source))[0]+'_rc.py')
filename = os.path.splitext(os.path.basename(source))[0]
# we remove "sakia." from the rc filename
# its only named like this so that imports are corrects in uic files
dest = os.path.join(gen_resources, filename.replace('sakia.', '')+'_rc.py')
exe = 'pyrcc5'
else:
continue
......
import sys, os, multiprocessing, subprocess, time, shutil
gen_resources = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))
gen_resources = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src/sakia'))
ts = os.path.abspath(os.path.join(os.path.dirname(__file__), 'res', 'i18n', 'ts'))
qm = os.path.abspath(os.path.join(os.path.dirname(__file__), 'res', 'i18n', 'qm'))
if not os.path.exists(qm):
......
from setuptools import setup, find_packages
import os
import re
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'src')))
import sakia
def which(program):
"""
Detect whether or not a program is installed.
Thanks to http://stackoverflow.com/a/377028/70191
"""
def is_exe(fpath):
return os.path.exists(fpath) and os.access(fpath, os.X_OK)
fpath, _ = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ['PATH'].split(os.pathsep):
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None
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'])]
for requirement in (l.strip() for l in open('requirements.txt')):
match = EDITABLE_REQUIREMENT.match(requirement)
if match:
assert which(match.group('vcs')) is not None, \
"VCS '%(vcs)s' must be installed in order to install %(link)s" % match.groupdict()
install_requires.append("%(package)s==%(version)s" % match.groupdict())
dependency_links.append(match.group('link'))
else:
install_requires.append(requirement)
sql_files = []
for file in os.listdir(os.path.join("src", "sakia", "data", "repositories")):
if file.endswith(".sql"):
sql_file = os.path.basename(file)
sql_files.append('src/sakia/data/repositories/{:}'.format(sql_file))
data_files.append(('sakia/data/repositories/', sql_files))
setup(
name='sakia',
version=sakia.__version__,
author="inso",
author_email="insomniak.fr@gmail.com",
description="A [duniter](https://github.com/duniter/duniter) Python client",
long_description=open('README.md').read(),
# Active la prise en compte du fichier MANIFEST.in
include_package_data=True,
url='https://github.com/duniter/sakia',
classifiers=[
"Programming Language :: Python",
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: French",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.5",
"Topic :: Communications",
],
install_requires=install_requires,
dependency_links=dependency_links,
packages=find_packages('src'),
package_dir={'sakia': 'src/sakia',
'i18n_rc': 'src/i18n_rc',
'icons_rc': 'src/icons_rc'},
entry_points={
'console_scripts': [
'sakia = sakia.main:main'
]
},
data_files=data_files
)
\ No newline at end of file
......@@ -2,7 +2,7 @@ import attr
import datetime
import logging
import socket
import i18n_rc
import sakia.i18n_rc
import async_timeout
import aiohttp
from PyQt5.QtCore import QObject, pyqtSignal, QTranslator, QCoreApplication, QLocale, Qt
......
......@@ -35,7 +35,7 @@
<string>Register a new identity</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/new_membership</normaloff>:/icons/new_membership</iconset>
</property>
<property name="iconSize">
......@@ -52,7 +52,7 @@
<string>Connect with an existing identity</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/connect_icon</normaloff>:/icons/connect_icon</iconset>
</property>
<property name="iconSize">
......@@ -69,7 +69,7 @@
<string>Connect a wallet</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/wallet_icon</normaloff>:/icons/wallet_icon</iconset>
</property>
<property name="iconSize">
......@@ -86,7 +86,7 @@
<string>Connect using a public key</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/duniter_info_icon</normaloff>:/icons/duniter_info_icon</iconset>
</property>
<property name="iconSize">
......@@ -484,7 +484,7 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
<resources>
<include location="../../../../../res/icons/icons.qrc"/>
<include location="../../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections/>
<slots>
......
......@@ -54,7 +54,7 @@
<string>Delete selected contact</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/not_member</normaloff>:/icons/not_member</iconset>
</property>
</widget>
......@@ -172,7 +172,7 @@
<string>Save</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/add_account_icon</normaloff>:/icons/add_account_icon</iconset>
</property>
<property name="iconSize">
......@@ -207,7 +207,7 @@
</layout>
</widget>
<resources>
<include location="../../../../../res/icons/icons.qrc"/>
<include location="../../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections/>
<slots>
......
......@@ -89,7 +89,7 @@
</layout>
</widget>
<resources>
<include location="../../../../../res/icons/icons.qrc"/>
<include location="../../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections/>
<slots>
......
......@@ -140,7 +140,7 @@
</action>
</widget>
<resources>
<include location="../../../../res/icons/icons.qrc"/>
<include location="../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections/>
<slots>
......
......@@ -38,7 +38,7 @@
<string>Network</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/wot_icon</normaloff>:/icons/wot_icon</iconset>
</property>
<property name="iconSize">
......@@ -55,7 +55,7 @@
<string>Search an identity</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/explorer_icon</normaloff>:/icons/explorer_icon</iconset>
</property>
<property name="iconSize">
......@@ -72,7 +72,7 @@
<string>Explore</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/add_community</normaloff>:/icons/add_community</iconset>
</property>
<property name="iconSize">
......@@ -102,7 +102,7 @@
<string>Contacts</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/connect_icon</normaloff>:/icons/connect_icon</iconset>
</property>
<property name="iconSize">
......@@ -119,7 +119,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/menu_icon</normaloff>:/icons/menu_icon</iconset>
</property>
<property name="iconSize">
......@@ -142,7 +142,7 @@
</layout>
</widget>
<resources>
<include location="../../../../../res/icons/icons.qrc"/>
<include location="../../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections/>
</ui>
......@@ -31,7 +31,7 @@
</customwidget>
</customwidgets>
<resources>
<include location="../../../../../../res/icons/icons.qrc"/>
<include location="../../../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections/>
<slots>
......
......@@ -22,7 +22,7 @@
<layout class="QVBoxLayout" name="verticalLayout"/>
</widget>
<resources>
<include location="../../../../res/icons/icons.qrc"/>
<include location="../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections/>
</ui>
......@@ -76,7 +76,7 @@ QGroupBox::title {
<string>Certify an identity</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/certification_icon</normaloff>:/icons/certification_icon</iconset>
</property>
</widget>
......@@ -117,7 +117,7 @@ QGroupBox::title {
<string/>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/refresh_icon</normaloff>:/icons/refresh_icon</iconset>
</property>
</widget>
......@@ -155,7 +155,7 @@ QGroupBox::title {
<string>Renew membership</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/renew_membership</normaloff>:/icons/renew_membership</iconset>
</property>
<property name="iconSize">
......@@ -187,7 +187,7 @@ QGroupBox::title {
</layout>
</widget>
<resources>
<include location="../../../../../res/icons/icons.qrc"/>
<include location="../../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections/>
</ui>
......@@ -40,7 +40,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/refresh_icon</normaloff>:/icons/refresh_icon</iconset>
</property>
<property name="iconSize">
......@@ -86,7 +86,7 @@
</layout>
</widget>
<resources>
<include location="../../../../../res/icons/icons.qrc"/>
<include location="../../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections>
<connection>
......
......@@ -90,7 +90,7 @@
<string>Send money</string>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/payment_icon</normaloff>:/icons/payment_icon</iconset>
</property>
<property name="iconSize">
......@@ -207,7 +207,7 @@
</customwidget>
</customwidgets>
<resources>
<include location="../../../../../res/icons/icons.qrc"/>
<include location="../../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections/>
</ui>
......@@ -30,7 +30,7 @@
<string>General</string>
</property>
<property name="icon">
<iconset resource="../../../res/icons/icons.qrc">
<iconset>
<normaloff>:/icons/settings_app_icon</normaloff>:/icons/settings_app_icon</iconset>
</property>
<property name="iconSize">
......@@ -50,7 +50,7 @@
<string>Display</string>
</property>
<property name="icon">
<iconset resource="../../../res/icons/icons.qrc">
<iconset>
<normaloff>:/icons/settings_display_icon</normaloff>:/icons/settings_display_icon</iconset>
</property>
<property name="iconSize">
......@@ -70,7 +70,7 @@
<string>Network</string>
</property>
<property name="icon">
<iconset resource="../../../res/icons/icons.qrc">
<iconset>
<normaloff>:/icons/settings_network_icon</normaloff>:/icons/settings_network_icon</iconset>
</property>
<property name="iconSize">
......@@ -414,7 +414,7 @@
</layout>
</widget>
<resources>
<include location="../../../res/icons/icons.qrc"/>
<include location="../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections>
<connection>
......
......@@ -36,7 +36,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../../../../../res/icons/icons.qrc">
<iconset resource="../../../../../res/icons/sakia.icons.qrc">
<normaloff>:/icons/home_icon</normaloff>:/icons/home_icon</iconset>
</property>
</widget>
......@@ -44,7 +44,7 @@
</layout>
</widget>
<resources>
<include location="../../../../../res/icons/icons.qrc"/>
<include location="../../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections/>
</ui>
......@@ -84,7 +84,7 @@ QGroupBox::title {
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../../../res/icons/icons.qrc">:/icons/member_icon</pixmap>
<pixmap resource="../../../../../res/icons/sakia.icons.qrc">:/icons/member_icon</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
......@@ -114,9 +114,9 @@ QGroupBox::title {
</layout>
</widget>
<resources>
<include location="../../../../../res/icons/icons.qrc"/>
<include location="../../../../../res/icons/icons.qrc"/>
<include location="../../../../../res/icons/icons.qrc"/>
<include location="../../../../../res/icons/sakia.icons.qrc"/>
<include location="../../../../../res/icons/sakia.icons.qrc"/>
<include location="../../../../../res/icons/sakia.icons.qrc"/>
</resources>
<connections/>
</ui>
......@@ -14,7 +14,7 @@
<string>MainWindow</string>
</property>
<property name="windowIcon">
<iconset resource="../icons/icons.qrc">
<iconset resource="../icons/sakia.icons.qrc">
<normaloff>:/icons/cutecoin_logo</normaloff>:/icons/cutecoin_logo</iconset>
</property>
<widget class="QWidget" name="centralwidget">
......@@ -40,7 +40,7 @@
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources>
<include location="../icons/icons.qrc"/>
<include location="../icons/sakia.icons.qrc"/>
</resources>
<connections/>
</ui>
......@@ -77,7 +77,8 @@ def exception_message(log_lines, exc_info):
mb.exec()
if __name__ == '__main__':
def main():
# activate ctrl-c interrupt
signal.signal(signal.SIGINT, signal.SIG_DFL)
sakia = QApplication(sys.argv)
......@@ -138,3 +139,6 @@ if __name__ == '__main__':
cleanup_lock(lock)
sys.exit()
if __name__ == '__main__':
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment