- don't say to download cpio (why just one package ?;)
[opensuse:osc.git] / setup.py
1 #!/usr/bin/env python
2
3 from distutils.core import setup
4 import distutils.command.build
5 import distutils.command.install_data
6 import os.path
7 import osc.core
8 import sys
9 from osc import commandline
10 from osc import babysitter
11 # optional support for py2exe
12 try:
13     import py2exe
14     HAVE_PY2EXE = True
15 except:
16     HAVE_PY2EXE = False
17
18
19 class build_osc(distutils.command.build.build, object):
20     """
21     Custom build command which generates man page.
22     """
23
24     def build_man_page(self):
25         """
26         """
27         import gzip
28         man_path = os.path.join('build', 'osc.1.gz')
29         distutils.log.info('generating %s' % man_path)
30         outfile = gzip.open(man_path, 'w')
31         osccli = commandline.Osc(stdout=outfile)
32         # FIXME: we cannot call the main method because osc expects an ~/.oscrc
33         # file (this would break builds in environments like the obs)
34         #osccli.main(argv = ['osc','man'])
35         osccli.optparser = osccli.get_optparser()
36         osccli.do_man(None)
37         outfile.close()
38
39     def run(self):
40         super(build_osc, self).run()
41         self.build_man_page()
42
43 addparams = {}
44 if HAVE_PY2EXE:
45     addparams['console'] = [{'script': 'osc-wrapper.py', 'dest_base': 'osc', 'icon_resources': [(1, 'osc.ico')]}]
46     addparams['zipfile'] = 'shared.lib'
47     addparams['options'] = {'py2exe': {'optimize': 0, 'compressed': True, 'packages': ['xml.etree', 'StringIO', 'gzip']}}
48
49 data_files = []
50 if sys.platform[:3] != 'win':
51     data_files.append((os.path.join('share', 'man', 'man1'), [os.path.join('build', 'osc.1.gz')]))
52
53 setup(name='osc',
54       version = osc.core.__version__,
55       description = 'openSUSE commander',
56       long_description = 'Command-line client for the openSUSE Build Service, which allows to access repositories in the openSUSE Build Service in similar way as Subversion repositories.',
57       author = 'openSUSE project',
58       author_email = 'opensuse-buildservice@opensuse.org',
59       license = 'GPL',
60       platforms = ['Linux', 'Mac OSX', 'Windows XP/2000/NT', 'Windows 95/98/ME'],
61       keywords = ['openSUSE', 'SUSE', 'RPM', 'build', 'buildservice'],
62       url = 'http://en.opensuse.org/openSUSE:OSC',
63       download_url = 'http://gitorious.org/opensuse/osc',
64
65       packages = ['osc', 'osc.util'],
66       scripts = ['osc_hotshot.py', 'osc-wrapper.py'],
67       data_files = data_files,
68
69       # Override certain command classes with our own ones
70       cmdclass = {
71         'build': build_osc,
72         },
73       **addparams
74      )