Added '0store optimise' command, which searches for duplicate files and hard-links...
[zeroinstall.git] / setup.py
blobe36079c93799c0a022d07481689f75dd3384da2d
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 license='LGPL',
42 cmdclass={
43 'build_py': build_with_data,
44 'install_lib': install_lib_exec,
46 long_description="""\
47 A running process is created by combining many different libraries (and other
48 components). In the Zero Install world, we have all versions of each library
49 available at all times. The problem then is how to choose which versions to
50 use.
52 The injector solves this problem by selecting components to meet a program's
53 requirements, according to a policy you give it. The injector finds out which
54 versions are available, and downloads and runs the ones you choose.""",
55 packages=["zeroinstall", "zeroinstall.zerostore", "zeroinstall.injector", "zeroinstall.0launch-gui"])