summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Piédallu <felix@piedallu.me>2020-05-12 11:27:50 +0200
committerHans Petter Jansson <hpj@cl.no>2020-06-18 16:56:05 +0200
commit46d5759e3c81c610cb9c49b212e744a10ff9553a (patch)
tree785c73fce2ae310edb4511137cef03774639c386
parent4cd0852d6ef08a8419a7f6d358e9f8232e65d05b (diff)
downloaddesktop-file-utils-46d5759e3c81c610cb9c49b212e744a10ff9553a.tar.gz
Use python for scripts instead of bash
-rwxr-xr-xchangelog.py22
-rw-r--r--install.py8
-rwxr-xr-xinstall.sh4
-rwxr-xr-xmake_dist.sh4
-rw-r--r--meson.build6
5 files changed, 34 insertions, 10 deletions
diff --git a/changelog.py b/changelog.py
new file mode 100755
index 0000000..ac41e30
--- /dev/null
+++ b/changelog.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python3
+
+import os, subprocess
+from pathlib import Path
+
+changelog_path = Path(
+ os.getenv('MESON_DIST_ROOT')
+ or os.getenv('MESON_SOURCE_ROOT')
+ or Path(__file__).parent
+) / 'ChangeLog'
+
+print('Writing changelog to {path}'.format(path=changelog_path))
+
+with open(changelog_path, 'w') as changelog_file:
+ changelog = subprocess.check_output([
+ 'git', 'log',
+ '--no-color',
+ '--find-renames',
+ '--find-copies',
+ '--name-status'
+ ]).decode()
+ changelog_file.write(changelog)
diff --git a/install.py b/install.py
new file mode 100644
index 0000000..e836381
--- /dev/null
+++ b/install.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python3
+
+import os
+
+os.symlink(
+ 'desktop-file-install',
+ os.getenv('MESON_INSTALL_DESTDIR_PREFIX') + '/bin/desktop-file-edit'
+)
diff --git a/install.sh b/install.sh
deleted file mode 100755
index 3ffa06e..0000000
--- a/install.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-
-ln -sf "desktop-file-install" \
- "${MESON_INSTALL_DESTDIR_PREFIX}/bin/desktop-file-edit"
diff --git a/make_dist.sh b/make_dist.sh
deleted file mode 100755
index 60ea4b7..0000000
--- a/make_dist.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-
-git log --no-color -M -C --name-status \
- > "${MESON_DIST_ROOT}/ChangeLog"
diff --git a/meson.build b/meson.build
index 45f2215..525a6f8 100644
--- a/meson.build
+++ b/meson.build
@@ -76,7 +76,9 @@ subdir('misc')
subdir('src')
# This script installs a symlink desktop-file-edit -> desktop-file-install
-meson.add_install_script('install.sh')
+meson.add_install_script('install.py')
# This script writes git log to Changelog.
-meson.add_dist_script('make_dist.sh')
+run_target('changelog', command: 'changelog.py')
+
+meson.add_dist_script('changelog.py')