comparison setup.py @ 98:9ba5c3df5e30

automagically install buildbotcustom
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 13 Jan 2011 11:20:57 -0800
parents 2de829d2c3f7
children 3b3c83f803b3
comparison
equal deleted inserted replaced
97:b41d58e93b2d 98:9ba5c3df5e30
1 import os, sys
1 from setuptools import setup, find_packages 2 from setuptools import setup, find_packages
2 import sys, os
3 3
4 version = '0.0' 4 version = '0.0'
5 5
6 setup(name='autobot', 6 setup(name='autobot',
7 version=version, 7 version=version,
31 create-autobot-master = autobot.template:create_master 31 create-autobot-master = autobot.template:create_master
32 create-autobot-slave = autobot.template:create_slave 32 create-autobot-slave = autobot.template:create_slave
33 create-autobot-project = autobot.template:create_project 33 create-autobot-project = autobot.template:create_project
34 """, 34 """,
35 ) 35 )
36
37 def install_hg(sources):
38 """
39 - sources : dict of hg sources to install: {'package': 'http://hg...'}
40 """
41 try:
42 from subprocess import check_call as call
43 except:
44 from subprocess import call
45
46 # see if you can find site-packages
47 import site
48 site_dir = os.path.abspath(os.path.dirname(site.__file__))
49 site_packages = os.path.join(site_dir, 'site-packages')
50 if not (os.path.exists(site_packages) and os.path.isdir(site_packages)):
51 raise IOError("Cannot find site-packages directory")
52
53 # figure out what you need to install
54 missing = set()
55 for source in sources:
56 try:
57 __import__(source)
58 except ImportError:
59 missing.add(source)
60
61 # install it
62 for source in missing:
63 call(['hg', 'clone', sources[source],
64 os.path.join(site_packages, source)])
65
66 ### install unpackaged dependencies
67 source = {'buildbotcustom': 'http://hg.mozilla.org/build/buildbotcustom'}
68 if set(['install', 'develop']).intersection(sys.argv[1:]):
69 try:
70 install_hg(source)
71 except:
72 print 'Please make sure the source is installed:'
73 print source