Added cope to simulate dpkg-query (for unit-tests).
[zeroinstall.git] / setup.py
blobe60760edd15b345025be52f93c4dc42e4fb93fdb
1 from distutils.core import setup
2 from distutils.command.build_py import build_py
3 from distutils.command.install_lib import install_lib
4 import os
5 import zeroinstall
7 class build_with_data(build_py):
8 """Python < 2.4 doesn't support package_data_files, so add it manually."""
9 package_data_files = [
10 "zeroinstall/0launch-gui/README",
11 "zeroinstall/0launch-gui/0launch-gui",
12 "zeroinstall/0launch-gui/ZeroInstall-GUI.xml",
14 def run(self):
15 # Copy .py files and build, as usual
16 build_py.run(self)
17 # Copy data files
18 for data_file in self.package_data_files:
19 outfile = os.path.join(self.build_lib, data_file)
20 self.copy_file(data_file, outfile, preserve_mode=0)
21 executable = (os.stat(data_file).st_mode & 0111) != 0
22 if executable:
23 os.chmod(outfile, os.stat(outfile).st_mode | 0111)
25 class install_lib_exec(install_lib):
26 def run(self):
27 install_lib.run(self)
28 if os.name != 'posix': return
30 launch = os.path.join(self.install_dir, 'zeroinstall/0launch-gui/0launch-gui')
31 os.chmod(launch, os.stat(launch).st_mode | 0111)
33 setup(name="zeroinstall-injector",
34 version=zeroinstall.version,
35 description="The Zero Install Injector (0launch)",
36 author="Thomas Leonard",
37 author_email="zero-install-devel@lists.sourceforge.net",
38 url="http://0install.net",
39 scripts=['0launch', '0alias', '0store'],
40 data_files = [('man/man1', ['0launch.1', '0alias.1', '0store.1']),
41 ('share/applications', ['applications/zeroinstall-zero2desktop.desktop']),
42 ('share/pixmaps', ['applications/zeroinstall-zero2desktop.png'])],
43 license='LGPL',
44 cmdclass={
45 'build_py': build_with_data,
46 'install_lib': install_lib_exec,
48 long_description="""\
49 A running process is created by combining many different libraries (and other
50 components). In the Zero Install world, we have all versions of each library
51 available at all times. The problem then is how to choose which versions to
52 use.
54 The injector solves this problem by selecting components to meet a program's
55 requirements, according to a policy you give it. The injector finds out which
56 versions are available, and downloads and runs the ones you choose.""",
57 packages=["zeroinstall", "zeroinstall.zerostore", "zeroinstall.injector", "zeroinstall.0launch-gui"])