~doctormo/django-deployer/trunk

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
#!/usr/bin/env python

from modeploy import __version__, installer

from distutils.core                 import setup
from distutils.command.install_lib  import install_lib

import os

# remove MANIFEST. distutils doesn't properly update it when the contents of directories change.
if os.path.exists('MANIFEST'): os.remove('MANIFEST')

class InstallLib(install_lib):
	def install(self):
		template = '''# Generated by setup.py do not modify

prefix        = "%(prefix)s"
share_dir     = os.path.join(prefix, 'share', 'modeploy') + '/'
installed     = 1

__stage__     = 'Beta'
'''

		filename = os.path.join(self.install_dir, 'modeploy', '__init__.py')
		install = self.distribution.get_command_obj('install')
		template = (template % dict(prefix=install.prefix))

		# We need the includes and setup solutions
		file = open('modeploy/__init__.py', 'rb').read().split('#==#')
		template = file[0] + template + file[2]

		self.mkpath(os.path.dirname(filename))
		fp = open(filename, 'w')
		fp.write(template)
		fp.close()

		# Return required information
		return install_lib.install(self) + [filename]	


setup(
		name             = 'python-modeploy',
		version          = __version__,
		description      = 'Website mysite Deployment',
		long_description = "Create debian packages of django websites for deployment.",
		author           = 'Martin Owens (DoctorMO)',
		author_email     = 'doctormo@gmail.com',
		url              = 'http://none-yet/',
		platforms        = 'any',
		license          = 'GPL',
		packages         = ['modeploy'],
		scripts          = ['django-deploy.py','django-build.py'],
		data_files       = [
			( 'share/modeploy/', installer.listfiles( 'data', '*' ) ),
		],
		cmdclass={ 'install_lib' : InstallLib },
	)