1 from distutils
.core
import setup
2 from distutils
.util
import convert_path
3 from distutils
.command
.build_py
import build_py
4 from distutils
.command
.install
import install
5 from distutils
.command
.install_lib
import install_lib
6 from distutils
.command
.install_data
import install_data
10 class build_with_data(build_py
):
11 """Python < 2.4 doesn't support package_data_files, so add it manually."""
12 package_data_files
= [
13 "zeroinstall/0launch-gui/README",
14 "zeroinstall/0launch-gui/0launch-gui",
15 "zeroinstall/0launch-gui/ZeroInstall-GUI.xml",
16 "zeroinstall/0launch-gui/zero-install.glade",
17 "zeroinstall/gtkui/desktop.glade",
20 # Copy .py files and build, as usual
23 for data_file
in self
.package_data_files
:
24 outfile
= os
.path
.join(self
.build_lib
, data_file
)
25 self
.copy_file(data_file
, outfile
, preserve_mode
=0)
26 executable
= (os
.stat(data_file
).st_mode
& 0111) != 0
28 os
.chmod(outfile
, os
.stat(outfile
).st_mode |
0111)
30 class install_lib_exec(install_lib
):
32 install_lib
.run(self
) # super.run()
33 if os
.name
!= 'posix': return
35 launch
= os
.path
.join(self
.install_dir
, 'zeroinstall/0launch-gui/0launch-gui')
36 os
.chmod(launch
, os
.stat(launch
).st_mode |
0111)
38 # distutils doesn't seem to have any support for adding configuration files.
39 # Unfortunately, the freedesktop.org menu spec strangely defines part of the
40 # menu definitions as configuration.
41 class my_install(install
):
42 def finalize_options(self
):
43 install
.finalize_options(self
) # super.finalize_options()
45 self
.__config
_dir
= os
.path
.join(self
.home
, '.config')
46 elif self
.prefix
== '/usr':
47 self
.__config
_dir
= os
.path
.join(self
.root
or '/', 'etc/xdg')
49 self
.__config
_dir
= os
.path
.join(self
.prefix
, 'etc/xdg')
52 install
.run(self
) # super.run()
53 menus_dir
= os
.path
.join(self
.__config
_dir
, 'menus/applications-merged')
54 self
.mkpath(menus_dir
)
55 menu
= convert_path('applications/zeroinstall.menu')
56 self
.copy_file(menu
, menus_dir
)
58 setup(name
="zeroinstall-injector",
59 version
=zeroinstall
.version
,
60 description
="The Zero Install Injector (0launch)",
61 author
="Thomas Leonard",
62 author_email
="zero-install-devel@lists.sourceforge.net",
63 url
="http://0install.net",
64 scripts
=['0launch', '0alias', '0store', '0store-secure-add', '0desktop'],
65 data_files
= [('man/man1', ['0launch.1', '0alias.1', '0store-secure-add.1', '0store.1', '0desktop.1']),
66 ('share/applications', ['applications/zeroinstall-zero2desktop.desktop', 'applications/zeroinstall-manage.desktop']),
67 ('share/desktop-directories', ['applications/zeroinstall.directory']),
68 ('share/pixmaps', ['applications/zeroinstall-zero2desktop.png'])],
71 'build_py': build_with_data
,
72 'install_lib': install_lib_exec
,
73 'install': my_install
,
76 A running process is created by combining many different libraries (and other
77 components). In the Zero Install world, we have all versions of each library
78 available at all times. The problem then is how to choose which versions to
81 The injector solves this problem by selecting components to meet a program's
82 requirements, according to a policy you give it. The injector finds out which
83 versions are available, and downloads and runs the ones you choose.""",
84 packages
=["zeroinstall", "zeroinstall.support", "zeroinstall.zerostore", "zeroinstall.injector", "zeroinstall.0launch-gui", "zeroinstall.gtkui"])