From a023fb708e7458d3b4c124a9abfc6bd43737e4fc Mon Sep 17 00:00:00 2001 From: Wojtek Porczyk Date: Mon, 26 Jun 2017 17:11:38 +0200 Subject: [PATCH] spring cleaning part 2 setup.py --- Makefile | 9 +++++++ qubes-manager | 5 ---- qubes-vm-settings | 5 ---- qubesmanager.pro | 4 ++-- {i18n => qubesmanager/i18n}/.gitignore | 0 .../i18n}/qubesmanager_en.ts | 0 .../i18n}/qubesmanager_es.ts | 0 rpm_spec/qmgr.spec | 24 +++++++------------ setup.py | 23 ++++++++++++++++++ 9 files changed, 43 insertions(+), 27 deletions(-) delete mode 100755 qubes-manager delete mode 100755 qubes-vm-settings rename {i18n => qubesmanager/i18n}/.gitignore (100%) rename {i18n => qubesmanager/i18n}/qubesmanager_en.ts (100%) rename {i18n => qubesmanager/i18n}/qubesmanager_es.ts (100%) create mode 100644 setup.py diff --git a/Makefile b/Makefile index 6923770..2ea88e1 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ RPMS_DIR=rpm/ VERSION := $(shell cat version) + +PYTHON ?= python3 + help: @echo "make rpms -- generate binary rpm packages" @echo "make res -- compile resources" @@ -27,6 +30,12 @@ res: translations: lrelease-qt4 qubesmanager.pro +python: + $(PYTHON) ./setup.py build + +python_install: + $(PYTHON) ./setup.py install -O1 --skip-build --root $(DESTDIR) + update_ts: res pylupdate4 qubesmanager.pro diff --git a/qubes-manager b/qubes-manager deleted file mode 100755 index e393b84..0000000 --- a/qubes-manager +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/python2 -import qubesmanager.main - -qubesmanager.main.main() - diff --git a/qubes-vm-settings b/qubes-vm-settings deleted file mode 100755 index 107525c..0000000 --- a/qubes-vm-settings +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/python -import qubesmanager.settings - -qubesmanager.settings.main() - diff --git a/qubesmanager.pro b/qubesmanager.pro index 4ccda62..51f4d1c 100644 --- a/qubesmanager.pro +++ b/qubesmanager.pro @@ -41,8 +41,8 @@ SOURCES = \ qubesmanager/ui_settingsdlg.py TRANSLATIONS = \ - i18n/qubesmanager_en.ts \ - i18n/qubesmanager_es.ts + qubesmanager/i18n/qubesmanager_en.ts \ + qubesmanager/i18n/qubesmanager_es.ts CODECFORTR = UTF-8 diff --git a/i18n/.gitignore b/qubesmanager/i18n/.gitignore similarity index 100% rename from i18n/.gitignore rename to qubesmanager/i18n/.gitignore diff --git a/i18n/qubesmanager_en.ts b/qubesmanager/i18n/qubesmanager_en.ts similarity index 100% rename from i18n/qubesmanager_en.ts rename to qubesmanager/i18n/qubesmanager_en.ts diff --git a/i18n/qubesmanager_es.ts b/qubesmanager/i18n/qubesmanager_es.ts similarity index 100% rename from i18n/qubesmanager_es.ts rename to qubesmanager/i18n/qubesmanager_es.ts diff --git a/rpm_spec/qmgr.spec b/rpm_spec/qmgr.spec index c185307..303da02 100644 --- a/rpm_spec/qmgr.spec +++ b/rpm_spec/qmgr.spec @@ -25,26 +25,17 @@ The Graphical Qubes VM Manager. %build make ui res translations -python3 -m compileall qubesmanager -python3 -O -m compileall qubesmanager +make python %install -mkdir -p $RPM_BUILD_ROOT/usr/bin/ -cp qubes-manager $RPM_BUILD_ROOT/usr/bin -cp qubes-vm-settings $RPM_BUILD_ROOT/usr/bin +make python_install \ + DESTDIR=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/usr/libexec/qubes-manager/ cp qubesmanager/mount_for_backup.sh $RPM_BUILD_ROOT/usr/libexec/qubes-manager/ cp qubesmanager/qvm_about.sh $RPM_BUILD_ROOT/usr/libexec/qubes-manager/ cp qubesmanager/qvm_net.py $RPM_BUILD_ROOT/usr/libexec/qubes-manager/ -mkdir -p $RPM_BUILD_ROOT%{python3_sitelib}/qubesmanager/ -cp -r qubesmanager/__pycache__ $RPM_BUILD_ROOT%{python3_sitelib}/qubesmanager/ -cp qubesmanager/*.py $RPM_BUILD_ROOT%{python3_sitelib}/qubesmanager/ - -mkdir -p $RPM_BUILD_ROOT%{python3_sitelib}/qubesmanager/i18n -cp i18n/qubesmanager_*.qm $RPM_BUILD_ROOT%{python3_sitelib}/qubesmanager/i18n/ - mkdir -p $RPM_BUILD_ROOT/usr/share/applications cp qubes-manager.desktop $RPM_BUILD_ROOT/usr/share/applications mkdir -p $RPM_BUILD_ROOT/etc/xdg/autostart/ @@ -65,13 +56,11 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -/usr/bin/qubes-manager /usr/bin/qubes-vm-settings /usr/libexec/qubes-manager/mount_for_backup.sh /usr/libexec/qubes-manager/qvm_about.sh /usr/libexec/qubes-manager/qvm_net.py -/usr/libexec/qubes-manager/qvm_net.pyo -/usr/libexec/qubes-manager/qvm_net.pyc + %dir %{python3_sitelib}/qubesmanager %{python3_sitelib}/qubesmanager/__pycache__ %{python3_sitelib}/qubesmanager/__init__.py @@ -110,6 +99,11 @@ rm -rf $RPM_BUILD_ROOT %{python3_sitelib}/qubesmanager/ui_informationnotes.py %{python3_sitelib}/qubesmanager/ui_networknotes.py %{python3_sitelib}/qubesmanager/i18n/qubesmanager_*.qm +%{python3_sitelib}/qubesmanager/i18n/qubesmanager_*.ts + +%dir %{python3_sitelib}/qubesmanager-*.egg-info +%{python3_sitelib}/qubesmanager-*.egg-info/* + /usr/share/applications/qubes-manager.desktop /etc/xdg/autostart/qubes-manager.desktop /etc/dbus-1/system.d/org.qubesos.QubesManager.conf diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..64ca2b0 --- /dev/null +++ b/setup.py @@ -0,0 +1,23 @@ +#!/usr/bin/python3 -O +# vim: fileencoding=utf-8 + +import setuptools + +if __name__ == '__main__': + setuptools.setup( + name='qubesmanager', + version=open('version').read().strip(), + author='Invisible Things Lab', + author_email='qubes-devel@googlegroups.com', + description='Qubes OS Manager', + license='GPL2+', + url='https://www.qubes-os.org/', + packages=setuptools.find_packages(), + package_data={ + 'qubesmanager': ['i18n/*'] + }, + entry_points={ + 'console_scripts': [ + 'qubes-vm-settings = qubesmanager.settings:main', + ], + })