63
print 'building manpages'
65
with open('%s.1' % x, 'w') as f:
66
runcmd(['python', x, '--generate-manpage=%s.1.in' % x,
67
'--output=%s.1' % x], stdout=f)
62
self.build_manpage('obnam')
64
def build_manpage(self, program):
65
print 'building manpage for %s' % program
66
self.generate_troff(program)
68
def generate_troff(self, program):
69
with open('%s.1' % program, 'w') as f:
71
['python', program, '--generate-manpage=%s.1.in' % program,
72
'--output=%s.1' % program],
70
76
class BuildDocs(Command):
145
162
if self.unit_tests:
146
print "run unit tests"
147
runcmd(['python', '-m', 'CoverageTestRunner',
148
'--ignore-missing-from=without-tests'])
149
os.remove('.coverage')
163
self.run_unit_tests()
151
165
if self.yarns and got_yarn:
153
['yarn', '-s', 'yarns/obnam.sh'] +
154
glob.glob('yarns/*.yarn'))
156
168
num_clients = '2'
157
169
num_generations = '16'
159
171
if self.lock_tests:
160
print "run local locking tests"
161
test_repo = tempfile.mkdtemp()
162
runcmd(['./test-locking', num_clients,
163
num_generations, test_repo, test_repo])
164
shutil.rmtree(test_repo)
172
self.run_lock_test(num_clients, num_generations)
166
174
if self.crash_tests:
167
print "run crash test"
168
runcmd(['./crash-test', '200'])
175
self.run_crash_test()
170
177
if self.sftp_tests:
171
print "run sftp tests"
172
runcmd(['./test-sftpfs'])
174
180
if self.network_lock_tests:
175
print "re-run locking tests using localhost networking"
176
test_repo = tempfile.mkdtemp()
177
repo_url = 'sftp://localhost/%s' % test_repo
178
runcmd(['./test-locking', num_clients,
179
num_generations, repo_url, test_repo])
180
shutil.rmtree(test_repo)
181
self.run_network_lock_test(num_clients, num_generations)
184
self.run_nitpick_checks()
186
print "setup.py check done"
188
def run_unit_tests(self):
189
print "run unit tests"
190
runcmd(['python', '-m', 'CoverageTestRunner',
191
'--ignore-missing-from=without-tests'])
192
os.remove('.coverage')
195
for repo_format in self.get_wanted_formats():
196
self.run_yarn_for_repo_format(repo_format)
198
def get_wanted_formats(self):
199
if 'REPOSITORY_FORMAT' in os.environ:
200
return [os.environ['REPOSITORY_FORMAT']]
202
return cliapp.runcmd(['./obnam', 'list-formats']).splitlines()
204
def run_yarn_for_repo_format(self, repo_format):
205
print 'run yarn for repository format %s' % repo_format
207
['yarn', '-s', 'yarns/obnam.sh'] +
208
['--env', 'REPOSITORY_FORMAT=' + repo_format] +
209
glob.glob('yarns/*.yarn'))
211
def run_lock_test(self, num_clients, num_generations):
212
print "run local locking tests"
213
test_repo = tempfile.mkdtemp()
214
runcmd(['./test-locking', num_clients,
215
num_generations, test_repo, test_repo])
216
shutil.rmtree(test_repo)
218
def run_network_lock_test(self, num_clients, num_generations):
219
print "run locking tests using localhost networking"
220
test_repo = tempfile.mkdtemp()
221
repo_url = 'sftp://localhost/%s' % test_repo
222
runcmd(['./test-locking', num_clients,
223
num_generations, repo_url, test_repo])
224
shutil.rmtree(test_repo)
226
def run_crash_test(self):
227
print "run crash test"
228
runcmd(['./crash-test', '200'])
230
def run_sftp_test(self):
231
print "run sftp tests"
232
runcmd(['./test-sftpfs'])
234
def run_nitpick_checks(self):
235
if os.path.exists('.git'):
183
236
sources = self.find_all_source_files()
184
237
self.check_sources_for_nitpicks(sources)
185
238
self.check_copyright_statements(sources)
187
print "setup.py check done"
240
print "no .git, no nitpick for you"
189
242
def check_sources_for_nitpicks(self, sources):
190
243
cliapp.runcmd(['./nitpicker'] + sources, stdout=None, stderr=None)
237
290
setup(name='obnam',
239
292
description='Backup software',
240
293
author='Lars Wirzenius',
241
294
author_email='liw@liw.fi',
242
url='http://liw.fi/obnam/',
295
url='http://obnam.org/',
243
296
scripts=['obnam', 'obnam-viewprof'],
244
packages=['obnamlib', 'obnamlib.plugins', 'obnamlib.fmt_6'],
301
'obnamlib.fmt_simple'
245
303
ext_modules=[Extension('obnamlib._obnam', sources=['_obnammodule.c'])],
246
304
data_files=[('share/man/man1', glob.glob('*.1'))],