diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-06-19 09:10:16 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-06-19 09:10:16 +0100 |
commit | a178af925ed2072f3986000a4e19a529d96e568c (patch) | |
tree | 5876f3abf9e605e5d405cf26d7afe48fe536c2a0 | |
parent | 4daba6be8394fc394b135659d70525ae1171249f (diff) | |
download | unperish-a178af925ed2072f3986000a4e19a529d96e568c.tar.gz |
Add clean command, and don't panic if setup.py does not exist.
-rwxr-xr-x | unperish | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -143,6 +143,17 @@ class Unperish(cliapp.Application): dsc] self.runcmd(*argv, cwd=self.settings['build-area']) + def cmd_clean(self, args): + '''Clean up the build-area (remove everything except the dir).''' + area = self.settings['build-area'] + if os.path.isdir(area): + for x in os.listdir(area): + pathname = os.path.join(area, x) + if os.path.isdir(x): + shutil.rmtree(x) + else: + os.remove(x) + def add_debian_changelog_entry(self): target = self.settings['upload-target'] self.runcmd('dch', @@ -160,13 +171,14 @@ class Unperish(cliapp.Application): return cp def autofill_meta(self): - name = self.runcmd('python', 'setup.py', '--name').strip() - if name: - self.meta.set('project', 'name', name) - - version = self.runcmd('python', 'setup.py', '--version').strip() - if version: - self.meta.set('project', 'version', version) + if os.path.exists('setup.py'): + name = self.runcmd('python', 'setup.py', '--name').strip() + if name: + self.meta.set('project', 'name', name) + + version = self.runcmd('python', 'setup.py', '--version').strip() + if version: + self.meta.set('project', 'version', version) def read_meta(self): self.meta.read([self.metafilename]) |