summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-08-13 20:56:48 +0300
committerLars Wirzenius <liw@liw.fi>2018-08-13 20:56:48 +0300
commit4a4a4d7d86d59b6f753cacca9041b4bb5c84e358 (patch)
treeecf568913809404bd8d7ab5ea42c2b82e720a1de
parent417b62d0718a697a338878b2ec721a49b378368b (diff)
downloadick-helpers-4a4a4d7d86d59b6f753cacca9041b4bb5c84e358.tar.gz
Change: try setup.py with python3 and then python
-rw-r--r--ick_helpers.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ick_helpers.py b/ick_helpers.py
index 99a52a8..00599b7 100644
--- a/ick_helpers.py
+++ b/ick_helpers.py
@@ -85,12 +85,17 @@ class Exec:
def get_project_name(self):
setup_py = os.path.join(self.dirname, 'setup.py')
- if os.path.exists(setup_py):
+ if os.path.exists(setup_py) and self.got_command('python3'):
+ output = self.get_stdout('python3', 'setup.py', '--name')
+ elif os.path.exists(setup_py) and self.got_command('python'):
output = self.get_stdout('python', 'setup.py', '--name')
else:
output = self.get_stdout('dpkg-parsechangelog', '-S', 'Source')
return output.strip()
+ def got_command(self, cmd):
+ return self.run_silently('command', '-v', cmd) == 0
+
def get_version_from_tag(self, tag):
parts = tag.split('-', 1)
debug('tag parts:', parts)