diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-08-01 12:30:34 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-08-01 12:30:34 +0300 |
commit | 86efda0e4552610a87276c18cfeb90371e7670ba (patch) | |
tree | de6f0f17dbf00e8d86f42cfd373c0e2d907a3b6a | |
parent | a5d33999716d7a3d9c5db53fcc02bffe2abea2bf (diff) | |
download | bumper-86efda0e4552610a87276c18cfeb90371e7670ba.tar.gz |
Add: run setup.py directly if executable
-rwxr-xr-x | bumper | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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') |