Fixing deb building, putting changelog into cache for env without internet (e.g flatpak).
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Adsooi 2022-01-28 23:49:23 +01:00
parent 0e2c1bdae4
commit d0fb6e9a3a
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
3 changed files with 18 additions and 6 deletions

View file

@ -145,6 +145,14 @@ class Helper(QObject):
@Slot() @Slot()
def fetchChangelog(self): def fetchChangelog(self):
changelog_cache_path = path.join(path.dirname(path.realpath(__file__), "CHANGELOG.md"))
if path.exists(changelog_cache_path):
# We have a cached version of the changelog, for env that don't have access to the internet.
f = open(changelog_cache_path);
self.changelogFetched.emit("".join(f.readlines()).strip())
f.close()
else:
# Fetch it from the internet.
runnable = ChangelogFetcher(self) runnable = ChangelogFetcher(self)
QThreadPool.globalInstance().start(runnable) ^QThreadPool.globalInstance().start(runnable)

View file

@ -2,4 +2,5 @@
recursive-include LogarithmPlotter/qml *.qml *.js *.qdoc qmldir *.svg *.md LICENSE recursive-include LogarithmPlotter/qml *.qml *.js *.qdoc qmldir *.svg *.md LICENSE
recursive-include LogarithmPlotter/i18n *.qm *.ts recursive-include LogarithmPlotter/i18n *.qm *.ts
include LogarithmPlotter/ *.svg include LogarithmPlotter/ *.svg
include LogarithmPlotter/ *.md

View file

@ -19,6 +19,7 @@
import setuptools import setuptools
import os import os
import sys import sys
from shutil import copyfile
print(sys.argv) print(sys.argv)
@ -41,6 +42,9 @@ if "PREFIX" not in os.environ and sys.platform == 'linux':
rmdir("/usr/share/applications/test") rmdir("/usr/share/applications/test")
os.environ["PREFIX"] = "/usr/share" os.environ["PREFIX"] = "/usr/share"
except: except:
if ".pybuild" in os.environ["HOME"]: # Launchpad building.
os.environ["PREFIX"] = "/usr/share"
else:
os.environ["PREFIX"] = os.environ["HOME"] + "/.local/share" os.environ["PREFIX"] = os.environ["HOME"] + "/.local/share"
from LogarithmPlotter import __VERSION__ as pkg_version from LogarithmPlotter import __VERSION__ as pkg_version
@ -81,6 +85,7 @@ def package_data():
for d,folders,files in os.walk("LogarithmPlotter/i18n"): for d,folders,files in os.walk("LogarithmPlotter/i18n"):
d = d[17:] d = d[17:]
pkg_data += [os.path.join(d, f) for f in files] pkg_data += [os.path.join(d, f) for f in files]
return pkg_data return pkg_data
data_files = [] data_files = []
@ -95,7 +100,6 @@ if sys.platform == 'linux':
data_files.append((os.environ["PREFIX"] + '/icons/hicolor/scalable/apps/', ['logplotter.svg'])) data_files.append((os.environ["PREFIX"] + '/icons/hicolor/scalable/apps/', ['logplotter.svg']))
if len(sys.argv) > 1: if len(sys.argv) > 1:
if sys.argv[1] == "install": if sys.argv[1] == "install":
from shutil import copyfile
os.makedirs(os.environ["PREFIX"] + '/applications/', exist_ok=True) os.makedirs(os.environ["PREFIX"] + '/applications/', exist_ok=True)
os.makedirs(os.environ["PREFIX"] + '/mime/packages/', exist_ok=True) os.makedirs(os.environ["PREFIX"] + '/mime/packages/', exist_ok=True)
os.makedirs(os.environ["PREFIX"] + '/icons/hicolor/scalable/mimetypes/', exist_ok=True) os.makedirs(os.environ["PREFIX"] + '/icons/hicolor/scalable/mimetypes/', exist_ok=True)
@ -113,8 +117,7 @@ if sys.platform == 'linux':
else: else:
copyfile(current_dir + '/linux/eu.ad5001.LogarithmPlotter.metainfo.xml', copyfile(current_dir + '/linux/eu.ad5001.LogarithmPlotter.metainfo.xml',
os.environ["PREFIX"] + '/metainfo/eu.ad5001.LogarithmPlotter.metainfo.xml') os.environ["PREFIX"] + '/metainfo/eu.ad5001.LogarithmPlotter.metainfo.xml')
copyfile(current_dir + '/linux/logarithmplotter.desktop', #copyfile(current_dir + '/linux/logarithmplotter.desktop', os.environ["PREFIX"] + '/applications/logarithmplotter.desktop')
os.environ["PREFIX"] + '/applications/logarithmplotter.desktop')
elif sys.argv[1] == "uninstall": elif sys.argv[1] == "uninstall":
os.remove(os.environ["PREFIX"] + '/applications/logarithmplotter.desktop') os.remove(os.environ["PREFIX"] + '/applications/logarithmplotter.desktop')
os.remove(os.environ["PREFIX"] + '/mime/packages/x-logarithm-plot.xml') os.remove(os.environ["PREFIX"] + '/mime/packages/x-logarithm-plot.xml')