[pygobject] setup.py: add sdist_gnome command for creating a release tarball for GNOME
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] setup.py: add sdist_gnome command for creating a release tarball for GNOME
- Date: Sat, 24 Mar 2018 16:53:37 +0000 (UTC)
commit d25f69ddea3975bec37909608364754c5d4fb0f3
Author: Christoph Reiter <reiter christoph gmail com>
Date: Sat Mar 24 17:09:00 2018 +0100
setup.py: add sdist_gnome command for creating a release tarball for GNOME
The difference is the lowercase name of the directory and it's a .tar.xz.
xztar requires Python 3 so the command only works with Python 3.
setup.py | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
---
diff --git a/setup.py b/setup.py
index 50dc381e..1b503bd0 100755
--- a/setup.py
+++ b/setup.py
@@ -24,6 +24,7 @@ import errno
import subprocess
import tarfile
import sysconfig
+import tempfile
from email import parser
try:
@@ -199,6 +200,34 @@ def filter_compiler_arguments(compiler, args):
return supported
+class sdist_gnome(Command):
+ description = "Create a source tarball for GNOME"
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ dist_dir = tempfile.mkdtemp()
+ try:
+ cmd = self.reinitialize_command("sdist")
+ cmd.dist_dir = dist_dir
+ cmd.ensure_finalized()
+ cmd.run()
+
+ base_name = self.distribution.get_fullname().lower()
+ cmd.make_release_tree(base_name, cmd.filelist.files)
+ try:
+ self.make_archive(base_name, "xztar", base_dir=base_name)
+ finally:
+ dir_util.remove_tree(base_name)
+ finally:
+ dir_util.remove_tree(dist_dir)
+
+
du_sdist = get_command_class("sdist")
@@ -228,7 +257,8 @@ class distcheck(du_sdist):
tracked_files = out.splitlines()
for ignore in [".gitignore"]:
- tracked_files.remove(ignore)
+ if ignore in tracked_files:
+ tracked_files.remove(ignore)
diff = set(tracked_files) - set(included_files)
assert not diff, (
@@ -1005,6 +1035,7 @@ def main():
cmdclass={
"build_ext": build_ext,
"distcheck": distcheck,
+ "sdist_gnome": sdist_gnome,
"build_tests": build_tests,
"test": test,
"quality": quality,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]