summaryrefslogtreecommitdiff
path: root/unperish
diff options
context:
space:
mode:
Diffstat (limited to 'unperish')
-rwxr-xr-xunperish22
1 files changed, 22 insertions, 0 deletions
diff --git a/unperish b/unperish
index 506c501..6ced5b7 100755
--- a/unperish
+++ b/unperish
@@ -75,6 +75,7 @@ class Unperish(cliapp.Application):
'upstream version for project')
def process_args(self, args):
+ self.deduce_unset_settings()
self.create_build_area()
self.already = set()
@@ -106,6 +107,27 @@ class Unperish(cliapp.Application):
else:
raise cliapp.AppException('unknown command %s' % subcommand)
+ def deduce_unset_settings(self):
+
+ def deduce_upstream_name():
+ if os.path.exists('setup.py'):
+ return self.runcmd(['python', 'setup.py', '--name']).strip()
+ return ''
+
+ def deduce_upstream_version():
+ if os.path.exists('setup.py'):
+ return self.runcmd(['python', 'setup.py', '--version']).strip()
+ return ''
+
+ table = {
+ 'upstream-name': deduce_upstream_name,
+ 'upstream-version': deduce_upstream_version,
+ }
+
+ for name in table:
+ if not self.settings[name]:
+ self.settings[name] = table[name]()
+
def create_build_area(self):
if not os.path.exists(self.settings['build-area']):
os.mkdir(self.settings['build-area'])