[Checkins] SVN: z3c.recipe.openoffice/branches/jacobholm-OOo3-support/ Initial version adding partial OpenOffice3.x support
Jacob Holm
jh at improva.dk
Thu Jul 1 11:50:20 EDT 2010
Log message for revision 114057:
Initial version adding partial OpenOffice3.x support
Changed:
A z3c.recipe.openoffice/branches/jacobholm-OOo3-support/
U z3c.recipe.openoffice/branches/jacobholm-OOo3-support/setup.py
U z3c.recipe.openoffice/branches/jacobholm-OOo3-support/src/z3c/recipe/openoffice/recipe.py
-=-
Modified: z3c.recipe.openoffice/branches/jacobholm-OOo3-support/setup.py
===================================================================
--- z3c.recipe.openoffice/trunk/setup.py 2010-06-28 16:39:48 UTC (rev 113959)
+++ z3c.recipe.openoffice/branches/jacobholm-OOo3-support/setup.py 2010-07-01 15:50:20 UTC (rev 114057)
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os
-version = '0.3'
+version = '0.4dev'
name='z3c.recipe.openoffice'
def read(*rnames):
Modified: z3c.recipe.openoffice/branches/jacobholm-OOo3-support/src/z3c/recipe/openoffice/recipe.py
===================================================================
--- z3c.recipe.openoffice/trunk/src/z3c/recipe/openoffice/recipe.py 2010-06-28 16:39:48 UTC (rev 113959)
+++ z3c.recipe.openoffice/branches/jacobholm-OOo3-support/src/z3c/recipe/openoffice/recipe.py 2010-07-01 15:50:20 UTC (rev 114057)
@@ -22,9 +22,9 @@
license='ZPL 2.1',
keywords = "openoffice",
url='http://svn.affinitic.be',
- packages=find_packages('src'),
+ packages=find_packages('%(src)s'),
include_package_data=True,
- package_dir = {'': 'src'},
+ package_dir = {'': '%(src)s'},
namespace_packages=[],
install_requires=['setuptools'],
zip_safe=False)
@@ -128,26 +128,56 @@
self.logger.info('No need to re-install openoffice part')
return False
self.logger.info("Copying unpacked contents")
- shutil.copytree(os.path.join(storage, 'opt', 'openoffice.org%s' % self.options['version']),
- location)
+ version = self.options['version']
+ if version[:2] == '3.':
+ from_dir = os.path.join(storage, 'opt', 'openoffice.org3')
+ else:
+ from_dir = os.path.join(storage, 'opt', 'openoffice.org' + version)
+ shutil.copytree(from_dir, location)
return True
def install_pyuno_egg(self):
self.logger.info("Creating pyuno egg")
location = self.options['location']
- program_dir = os.path.join(location, 'program')
- fd = open(os.path.join(program_dir,'setup.py'), 'w')
- fd.write(PYUNO_SETUP)
- fd.close()
- egg_src_dir = os.path.join(program_dir,'src')
- if not os.path.isdir(egg_src_dir):
- os.mkdir(egg_src_dir)
- for filename in ['pyuno.so', 'uno.py']:
- if not os.path.islink(os.path.join(egg_src_dir,filename)):
- os.symlink(os.path.join(program_dir,filename),
- os.path.join(egg_src_dir,filename))
- eggDirectory = self.buildout['buildout']['eggs-directory']
- zc.buildout.easy_install.develop(program_dir, eggDirectory)
+ if self.options['version'][:2]=='3.':
+ program_dir = os.path.join(location, 'program')
+ basis_dir = os.path.join(location, 'basis-link')
+ # Hack uno.py to set the necessary environment variables
+ uno_py = os.path.join(basis_dir, 'program', 'uno.py')
+ fd = open(uno_py, 'rb')
+ uno_py_data = fd.read()
+ fd.close()
+ os.chmod(uno_py, 0644)
+ fd = open(uno_py, 'wb')
+ fd.write("import os\n")
+ fd.write("os.environ['UNO_PATH'] = %r\n" % program_dir)
+ rc = 'vnd.sun.star.pathname:' \
+ + os.path.join(program_dir, 'fundamentalrc')
+ fd.write("os.environ['URE_BOOTSTRAP'] = %r\n" % rc)
+ fd.write(uno_py_data)
+ fd.close()
+ os.chmod(uno_py, 0444)
+ # Create setup.py
+ fd = open(os.path.join(basis_dir, 'setup.py'), 'w')
+ fd.write(PYUNO_SETUP % dict(src='program'))
+ fd.close()
+ # Install egg-link
+ eggDirectory = self.buildout['buildout']['develop-eggs-directory']
+ zc.buildout.easy_install.develop(basis_dir, eggDirectory)
+ else:
+ program_dir = os.path.join(location, 'program')
+ fd = open(os.path.join(program_dir,'setup.py'), 'w')
+ fd.write(PYUNO_SETUP % dict(src='src'))
+ fd.close()
+ egg_src_dir = os.path.join(program_dir,'src')
+ if not os.path.isdir(egg_src_dir):
+ os.mkdir(egg_src_dir)
+ for filename in ['pyuno.so', 'uno.py']:
+ if not os.path.islink(os.path.join(egg_src_dir,filename)):
+ os.symlink(os.path.join(program_dir,filename),
+ os.path.join(egg_src_dir,filename))
+ eggDirectory = self.buildout['buildout']['eggs-directory']
+ zc.buildout.easy_install.develop(program_dir, eggDirectory)
def hack_python(self):
"""Hack a different python into the OpenOffice installation.
@@ -159,24 +189,47 @@
"""
self.logger.info("Hacking python into openoffice")
location = self.options['location']
- program_dir = os.path.join(location, 'program')
- os.remove(os.path.join(program_dir, 'libpython2.3.so.1.0'))
- shutil.rmtree(os.path.join(program_dir, 'python-core-2.3.4'))
- os.remove(os.path.join(program_dir, 'pythonloader.unorc'))
-
- pythonhome = sys.exec_prefix
- pythonpath = sysconfig.get_python_lib(standard_lib=True)
- so = os.path.join(
- os.path.split(pythonpath)[0],
- 'libpython%s.so.1.0' % sys.version[:3])
- os.symlink(so, os.path.join(program_dir, 'libpython2.3.so.1.0'))
- f = open(os.path.join(location, 'program', 'pythonloader.unorc'), 'w')
- f.write('''\
+ if self.options['version'][:2]=='3.':
+ raise NotImplementedError("Hacking the python version doesn't work "
+ "for OOo 3.x (yet)")
+# program_dir = os.path.join(location, 'basis-link', 'program')
+# os.remove(os.path.join(program_dir, 'libpython2.6.so.1.0'))
+# shutil.rmtree(os.path.join(program_dir, 'python-core-2.6.1'))
+# os.remove(os.path.join(program_dir, 'pythonloader.unorc'))
+
+# pythonhome = sys.exec_prefix
+# pythonpath = sysconfig.get_python_lib(standard_lib=True)
+# so = os.path.join(
+# os.path.split(pythonpath)[0],
+# 'libpython%s.so.1.0' % sys.version[:3])
+# os.symlink(so, os.path.join(program_dir, 'libpython2.6.so.1.0'))
+
+# f = open(os.path.join(program_dir, 'pythonloader.unorc'), 'w')
+# f.write('''\
+# [Bootstrap]
+# PYTHONHOME=file://%s
+# PYTHONPATH=%s $ORIGIN
+# ''' % (pythonhome, ' '.join(sys.path)))
+# f.close()
+ else:
+ program_dir = os.path.join(location, 'program')
+ os.remove(os.path.join(program_dir, 'libpython2.3.so.1.0'))
+ shutil.rmtree(os.path.join(program_dir, 'python-core-2.3.4'))
+ os.remove(os.path.join(program_dir, 'pythonloader.unorc'))
+
+ pythonhome = sys.exec_prefix
+ pythonpath = sysconfig.get_python_lib(standard_lib=True)
+ so = os.path.join(
+ os.path.split(pythonpath)[0],
+ 'libpython%s.so.1.0' % sys.version[:3])
+ os.symlink(so, os.path.join(program_dir, 'libpython2.3.so.1.0'))
+ f = open(os.path.join(program_dir, 'pythonloader.unorc'), 'w')
+ f.write('''\
[Bootstrap]
PYTHONHOME=file://%s
PYTHONPATH=%s $ORIGIN
''' % (pythonhome, pythonpath))
- f.close()
+ f.close()
def update(self):
pass
More information about the checkins
mailing list