1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/usr/bin/env python
from distutils.core import setup
from setuptools import find_packages
import os
import stat
target_hooks_dir = '/usr/share/pbuilderjenkins/hooks'
hooks_dir = 'hooks/'
def get_kwargs_for_hook_text_format():
kwargs = {}
generic_hooks = ['build_and_result_path_logic',
'add_cmake_dh_auto_configure_option',
'add_autotools_dh_auto_configure_option',
'add_qmake_dh_auto_configure_option'
]
for generic_hook in generic_hooks:
kwargs[generic_hook] = open(hooks_dir + generic_hook).read()
return kwargs
def process_template_hook(hook):
input_filename = hooks_dir + hook
output_filename = hooks_dir + hook
if output_filename.endswith('.in'):
output_filename = output_filename[:-3]
hook_text = open(input_filename).read()
format_kwargs = get_kwargs_for_hook_text_format()
hook_text = hook_text.format(**format_kwargs)
open(output_filename, 'w').write(hook_text)
os.chmod(output_filename, 0775)
return output_filename
#the following list is from pbuilder(8) + H which is pbuilderjenkins specific
hooks_prefix = ('H', 'A', 'B', 'C', 'D', 'E', 'F', 'G')
hooks = []
for hook in os.listdir(hooks_dir):
if not hook.startswith(hooks_prefix):
continue
if hook.endswith('.in'):
hook_name = process_template_hook(hook)
hooks.append(hook_name)
else:
hooks.append(hooks_dir + hook)
setup(
name='pbuilderjenkins',
version='1.0',
description='PBuilderJenkins tool for Ubuntu.',
author='Sergio Schvezov',
author_email='sergio.schvezov@canonical.com',
url='https://launchpad.net/pbuilderjenkins',
license='GPLv3',
packages=find_packages(exclude=['tests', ]),
test_suite='tests',
scripts=['bin/pbuilderjenkins', 'bin/generate-private-ppa-hooks'],
data_files=[(target_hooks_dir, hooks)]
)
|