summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-08-01 12:30:34 +0300
committerLars Wirzenius <liw@liw.fi>2017-08-01 12:30:34 +0300
commit86efda0e4552610a87276c18cfeb90371e7670ba (patch)
treede6f0f17dbf00e8d86f42cfd373c0e2d907a3b6a
parenta5d33999716d7a3d9c5db53fcc02bffe2abea2bf (diff)
downloadbumper-86efda0e4552610a87276c18cfeb90371e7670ba.tar.gz
Add: run setup.py directly if executable
-rwxr-xr-xbumper14
1 files changed, 13 insertions, 1 deletions
diff --git a/bumper b/bumper
index b847f94..bcf8899 100755
--- a/bumper
+++ b/bumper
@@ -17,7 +17,9 @@
# =*= License: GPL-3+ =*=
+import os
import re
+import stat
import time
import cliapp
@@ -104,7 +106,17 @@ class Bumper(cliapp.Application):
return version_files[0]
def run_setup(self, *args):
- return cliapp.runcmd(['python', 'setup.py'] + list(args)).strip()
+ prefix = None
+
+ # If we can run setup.py directly, we do. This takes care of Py2 vs Py3.
+ st = os.lstat('setup.py')
+ if (stat.S_IMODE(st.st_mode) & stat.S_IXUSR) == stat.S_IXUSR:
+ prefix = ['./setup.py']
+
+ if prefix is None:
+ prefix = ['python', 'setup.py']
+
+ return cliapp.runcmd(prefix + list(args)).strip()
def get_current_version(self):
return self.run_setup('--version')