[Checkins] SVN: z3c.recipe.openoffice/trunk/ add pyuno egg creation
Jean-Fran�ois Roche
jfroche at jfroche.be
Mon Jan 7 11:25:49 EST 2008
Log message for revision 82733:
add pyuno egg creation
Changed:
A z3c.recipe.openoffice/trunk/README.txt
U z3c.recipe.openoffice/trunk/setup.py
U z3c.recipe.openoffice/trunk/src/z3c/recipe/openoffice/recipe.py
-=-
Added: z3c.recipe.openoffice/trunk/README.txt
===================================================================
--- z3c.recipe.openoffice/trunk/README.txt (rev 0)
+++ z3c.recipe.openoffice/trunk/README.txt 2008-01-07 16:25:48 UTC (rev 82733)
@@ -0,0 +1,6 @@
+This recipe download openoffice in your buildout, it can also (optional)
+create egg with pyuno and change the default python used by openoffice
+
+Original author: Martijn Faassen - faassen at infrae.com
+
+Modified by: Jean-François Roche - jfroche at affinitic.be
Property changes on: z3c.recipe.openoffice/trunk/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: z3c.recipe.openoffice/trunk/setup.py
===================================================================
--- z3c.recipe.openoffice/trunk/setup.py 2008-01-07 16:17:08 UTC (rev 82732)
+++ z3c.recipe.openoffice/trunk/setup.py 2008-01-07 16:25:48 UTC (rev 82733)
@@ -1,21 +1,23 @@
from setuptools import setup, find_packages
-import sys, os
+import os
-version = '0.1'
-
+version = '0.2'
name='z3c.recipe.openoffice'
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
setup(
name=name,
version=version,
author="Infrae",
author_email="faassen at infrae.com",
description="zc.buildout recipe that downloads and installs OpenOffice.org",
- long_description="""\
- """,
+ long_description=(read('README.txt')),
license='ZPL 2.1',
keywords = "buildout openoffice",
url='http://svn.zope.org/z3c.recipe.openoffice',
+
packages=find_packages('src'),
include_package_data=True,
package_dir = {'': 'src'},
Modified: z3c.recipe.openoffice/trunk/src/z3c/recipe/openoffice/recipe.py
===================================================================
--- z3c.recipe.openoffice/trunk/src/z3c/recipe/openoffice/recipe.py 2008-01-07 16:17:08 UTC (rev 82732)
+++ z3c.recipe.openoffice/trunk/src/z3c/recipe/openoffice/recipe.py 2008-01-07 16:25:48 UTC (rev 82733)
@@ -3,9 +3,33 @@
import os, sys
import shutil
import urllib
-import tempfile
from distutils import sysconfig
+import zc.buildout
+PYUNO_SETUP = """
+from setuptools import setup, find_packages
+import sys, os
+
+version = '0.1'
+
+name='pyuno'
+
+setup(name=name,
+ version=version,
+ author="Affinitic",
+ author_email="jfroche at affinitic.be",
+ description="little egg with pyuno",
+ license='ZPL 2.1',
+ keywords = "openoffice",
+ url='http://svn.affinitic.be',
+ packages=find_packages('src'),
+ include_package_data=True,
+ package_dir = {'': 'src'},
+ namespace_packages=[],
+ install_requires=[],
+ zip_safe=False)
+"""
+
class Recipe(object):
def __init__(self, buildout, name, options):
self.buildout = buildout
@@ -21,13 +45,20 @@
options['tmp-storage'] = os.path.join(
buildout['buildout']['directory'], 'tmp-storage')
-
options.setdefault(
+ 'version','2.3')
+ options.setdefault(
'download-url',
- 'ftp://ftp.snt.utwente.nl/pub/software/openoffice/stable/2.0.4/OOo_2.0.4_LinuxIntel_install.tar.gz')
+ 'ftp://ftp.openoffice.skynet.be/pub/ftp.openoffice.org/stable/2.3.1/OOo_2.3.1_LinuxIntel_install_en-US.tar.gz')
options.setdefault(
'unpack-name',
- 'OOD680_m5_native_packed-1_en-US.9073')
+ 'OOG680_m9_native_packed-1_en-US.9238')
+ options.setdefault(
+ 'hack-openoffice-python',
+ 'no')
+ options.setdefault(
+ 'install-pyuno-egg',
+ 'no')
def install(self):
location = self.options['location']
@@ -40,10 +71,13 @@
self.untar(download_file, storage)
self.unrpm(storage)
copy_created = self.copy(storage)
- if copy_created:
+ if copy_created and \
+ self.options['hack-openoffice-python'].lower() == 'yes':
self.hack_python()
+ if copy_created and self.options['install-pyuno-egg'].lower() == 'yes':
+ self.install_pyuno_egg()
return location
-
+
def download(self, whereto):
"""Download tarball into temporary location.
"""
@@ -66,7 +100,6 @@
self.logger.info("Unpack directory (%s) already exists... "
"skipping unpack." % unpack_dir)
return
-
self.logger.info("Unpacking tarball")
os.chdir(storage)
status = os.system('tar xzf ' + download_file)
@@ -95,10 +128,27 @@
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.org2.0'),
+ shutil.copytree(os.path.join(storage, 'opt', 'openoffice.org%s' % self.options['version']),
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)
+
def hack_python(self):
"""Hack a different python into the OpenOffice installation.
@@ -127,3 +177,6 @@
PYTHONPATH=%s $ORIGIN
''' % (pythonhome, pythonpath))
f.close()
+
+ def update(self):
+ pass
More information about the Checkins
mailing list