diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-08-21 19:41:33 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-08-21 19:41:33 +0100 |
commit | 94d2159f80c2c13ef75a49fcad118d0640c5fe03 (patch) | |
tree | 879de62250ac66e66101a338b0aa282d8d1c55e0 | |
parent | 96f784dc2d798b840da55d0d56ffa12cf8d47146 (diff) | |
download | unperish-94d2159f80c2c13ef75a49fcad118d0640c5fe03.tar.gz |
Deduce values for upstream-name and upstream-version unless given.
-rwxr-xr-x | unperish | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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']) |