Skip to content

Instantly share code, notes, and snippets.

@chrissem
Created September 11, 2012 09:16
Show Gist options
  • Save chrissem/3697132 to your computer and use it in GitHub Desktop.
Save chrissem/3697132 to your computer and use it in GitHub Desktop.
JCC buildfile for bio-formats
#!/usr/bin/env python
import os
compiler = 'python -m jcc'
# jcc options
options = [
'build',
'install'
]
# egg version
version = '0.0.9'
# module
module = 'omexml'
# jars to wrap
# place in current dir
jars = ['ome-xml.jar']
# java packages to wrap if used by jars
# add classes to list for explicit wrapping
packages = {
'org.w3c.dom' : [],
'java.io' : ['ByteArrayOutputStream'],
'javax.xml.parsers' : []
}
# additional jars used by wrapped jar
# place in same folder as one-xml.jar
classpath = [
'log4j.jar',
'slf4j-api.jar',
'slf4j-log4j12.jar'
]
# handle naming conflicts
renames = [
('ome.xml.model.enums.Enumeration', 'OmeEnumeration')
]
# build command line
command = compiler
command += " --version " + version
for o in options:
command += ' --' + o
command += ' --python ' + module
for j in jars:
command += ' --jar ' + j
for package, classes in packages.items():
command += ' --package ' + package
for c in classes:
command += ' ' + package + '.' + c
for c in classpath:
command += ' --classpath ' + c
for (old,new) in renames:
command += ' --rename ' + old + '=' + new
print command
os.system(command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment