Coverage for modules/org/openteacher/profileRunners/packagers/rpm/rpm : 41%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
#! /usr/bin/env python3 # -*- coding: utf-8 -*-
# Copyright 2012-2013, Marten de Vries # # This file is part of OpenTeacher. # # OpenTeacher is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OpenTeacher is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with OpenTeacher. If not, see <http://www.gnu.org/licenses/>.
[install] prefix = /usr """.strip()
/usr/bin/update-mime-database %{_datadir}/mime &> /dev/null || : /usr/bin/update-desktop-database &> /dev/null || : /usr/bin/gtk-update-icon-cache -f %{_datadir}/icons/hicolor &>/dev/null || : """.strip()
self._mm.mods(type="sourceWithSetupSaver"), self._mm.mods(type="metadata"), self._mm.mods(type="execute"), ) "package-rpm": 0, "default": -1, }
self._modules = set(self._mm.mods(type="modules")).pop() self._metadata= self._modules.default("active", type="metadata").metadata self._modules.default(type="execute").startRunning.handle(self._run)
self._platform = platform.linux_distribution()[0].strip()
self.active = True
try: release = sys.argv[1] path = sys.argv[2] except IndexError: sys.stderr.write("Please specify a .rpm release number and a path for the rpm file (ending in .rpm) as the last command line arguments.\n") return sourcePath = self._modules.default("active", type="sourceWithSetupSaver").saveSource()
#set install prefix to /usr with open(os.path.join(sourcePath, "setup.cfg"), "w", encoding='UTF-8') as f: f.write(SETUP_CFG)
#make sure all caches etc. are updated. with open(os.path.join(sourcePath, "post-changes.sh"), "w", encoding='UTF-8') as f: f.write(POST_CHANGES)
#determine requirements based on distribution if self._platform == "Fedora": requirements = "python3, python3-qt5, python3-qt5-webkit, espeak, python3-chardet, python3-enchant, tesseract, python3-imaging, python3-urwid" elif self._platform == "openSUSE": # add python-enchant if OpenSUSE adds it to the repos requirements = "python3-qt5, espeak, python3-chardet, tesseract-ocr, python3-Pillow, python3-urwid"
oldCwd = os.getcwd() os.chdir(sourcePath) subprocess.check_call([ sys.executable or "python", "setup.py", "bdist_rpm", "--group", "Applications/Productivity", "--packager", "%s <%s>" % (self._metadata["authors"], self._metadata["email"]), "--release", release, #temporarily not needed: python-django, python-django-guardian #add if packaged somewhere in the future: python-graphviz "--requires", requirements, "--post-install", "post-changes.sh", "--post-uninstall", "post-changes.sh", ]) os.chdir(oldCwd) shutil.copy( glob.glob(os.path.join(sourcePath, "dist/*.noarch.rpm"))[0], path ) print("Please keep in mind that an rpm built on one distro, might not work on another.")
self.active = False
del self._modules
|