comparison setup.py @ 547:8b5e142354ca

installation: added wokkel to dependencies, and removed custom wokkel installation in setup.py (muc branch is now merged mainstream)
author Goffi <goffi@goffi.org>
date Wed, 14 Nov 2012 21:44:25 +0100
parents 2a072735e459
children 8022cca26595
comparison
equal deleted inserted replaced
546:9dd297c513b4 547:8b5e142354ca
32 32
33 class MercurialException(Exception): 33 class MercurialException(Exception):
34 pass 34 pass
35 35
36 def module_installed(module_name): 36 def module_installed(module_name):
37 """Try to import muc from custom wokkel build 37 """Try to import module_name, and return False if it failed
38 @param module_name: name of the module to test 38 @param module_name: name of the module to test
39 @return: True if successful""" 39 @return: True if successful"""
40 try: 40 try:
41 __import__(module_name) 41 __import__(module_name)
42 except: 42 except:
75 assert (copied) 75 assert (copied)
76 #we change the perm in the same way as in the original install_scripts 76 #we change the perm in the same way as in the original install_scripts
77 mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777 77 mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777
78 os.chmod(dest_name, mode) 78 os.chmod(dest_name, mode)
79 79
80
81 def custom_wokkel_requirement(self):
82 """Test if the custom wokkel is present, else get and build it"""
83 if not module_installed('wokkel.muc'):
84 sys.stdout.write ('Custom wokkel is not present, building it\n')
85 sys.stdout.flush()
86 import tempfile
87 ori_path = os.getcwd()
88 work_path = tempfile.mkdtemp()
89 os.chdir(work_path)
90 hg_path = subprocess.Popen('which hg', stdout=subprocess.PIPE, shell=True).communicate()[0][:-1]
91 #we are now in a temp dir, we can get the repositories
92 commands = ['%s clone http://hg.ik.nu/wokkel -r f9cd8ca1a62d' % hg_path, #XXX: we use specific revision to avoid merge conflict
93 'cd wokkel',
94 '%s pull -f http://hg.ik.nu/ralphm/wokkel-muc-client-support-24-2 -r 1b19c49d30c2' % hg_path,
95 '%s merge wokkel-muc-client-support-24' % hg_path,
96 '%s commit -u "SaT installation script" -m "Merged wokkel\'s MUC branch"' % hg_path,
97 '%s setup.py %s' % (sys.executable, ' '.join(sys.argv[1:]))] #XXX: we use the same arguments as for this setup.py
98 for command in commands:
99 if command.startswith('cd '):
100 os.chdir(command[3:])
101 else:
102 ret = subprocess.call(command, stdout=open('/dev/null', 'w'), shell=True)
103 if ret!=0:
104 os.chdir(ori_path)
105 sys.stderr.write ("ERROR while building/installing custom wokkel\n")
106 sys.stderr.write ('Error happened when executing [%s]\n' % command)
107 sys.stderr.write ('tmpdir is [%s]\n' % work_path)
108 raise MercurialException
109 os.chdir(ori_path)
110 sys.stdout.write ("Custom wokkel builded and installed, removing temporary files\n")
111 import shutil
112 shutil.rmtree(work_path)
113 sys.stdout.write ("done\n")
114 else:
115 sys.stdout.write ("Custom wokkel already installed\n")
116
117
118 def run(self): 80 def run(self):
119 install.run(self) 81 install.run(self)
120 sys.stdout.write ('running post installation stuff\n') 82 sys.stdout.write ('running post installation stuff\n')
121 sys.stdout.flush() 83 sys.stdout.flush()
122 self.sh_script_path = os.path.join(self.install_lib,'sat','sat.sh') 84 self.sh_script_path = os.path.join(self.install_lib,'sat','sat.sh')
123 self.primitivus_path = os.path.join(self.install_lib,'sat_frontends','primitivus') 85 self.primitivus_path = os.path.join(self.install_lib,'sat_frontends','primitivus')
124 self.custom_auto_options() 86 self.custom_auto_options()
125 self.custom_create_links() 87 self.custom_create_links()
126 self.custom_wokkel_requirement()
127 88
128 89
129 def preinstall_check(): 90 def preinstall_check():
130 """Check presence of problematic dependencies, and try to install them with package manager 91 """Check presence of problematic dependencies, and try to install them with package manager
131 This ugly stuff is necessary as distributions are not installed correctly with setuptools/distribute 92 This ugly stuff is necessary as distributions are not installed correctly with setuptools/distribute
206 ('share/doc/%s' % NAME, ['CHANGELOG', 'COPYING', 'INSTALL', 'README', 'README4TRANSLATORS']), 167 ('share/doc/%s' % NAME, ['CHANGELOG', 'COPYING', 'INSTALL', 'README', 'README4TRANSLATORS']),
207 ], 168 ],
208 scripts=['frontends/src/jp/jp', 'frontends/src/primitivus/primitivus', 'frontends/src/wix/wix'], 169 scripts=['frontends/src/jp/jp', 'frontends/src/primitivus/primitivus', 'frontends/src/wix/wix'],
209 zip_safe=False, 170 zip_safe=False,
210 dependency_links = ['http://www.blarg.net/%7Esteveha/pyfeed-0.7.4.tar.gz','http://www.blarg.net/%7Esteveha/xe-0.7.4.tar.gz'], 171 dependency_links = ['http://www.blarg.net/%7Esteveha/pyfeed-0.7.4.tar.gz','http://www.blarg.net/%7Esteveha/xe-0.7.4.tar.gz'],
211 install_requires=['twisted', 'progressbar', 'urwid', 'beautifulsoup', 'mercurial', 'urwid-satext','pyfeed','xe'], 172 install_requires=['twisted', 'wokkel', 'progressbar', 'urwid', 'beautifulsoup', 'urwid-satext','pyfeed','xe'],
212 cmdclass=dict(install=custom_install), 173 cmdclass=dict(install=custom_install),
213 ) #XXX: The Mercurial dependency is just here to build the custom wokkel (with MUC branch), it must be removed 174 ) #XXX: wxpython doesn't work, it's managed with preinstall_check
214 # and replaced by wokkel as soon as MUC branch is officially available in wokkel main branch.
215 # wxpython doesn't work, it's managed with preinstall_check
216 175