I¹m a Python newbie... I am working on a project where I need to read and
write XMP metadata to PDF files. I found the Python XMP Toolkit at
http://code.google.com/p/python-xmp-toolkit/ and was able to download,
compile and install all the pieces (boost, Exempi and Python XMP Toolkit)
and write a script that can actually do what I want.

Now, my question is, how can I distribute this kind of solution to other
user¹s workstations? I don¹t want to have to repeat this whole process to
create the necessary environment on each user machine to be able to run this
python script.

Is there a way that I can bundle all the necessary dependencies (boost,
Exempi, Python XMP Toolkit) together so that to the user it is just a single
application? And if so, what about the compiled versions on Intel vs. G5
machines?

Below is the whole script. It basically takes a file path and two values as
arguments and writes the two values into the XMP stream of the file.

It seems pretty simple, but the distribution part seems daunting to me.

Thanks.
Jim


import sys
from libxmp import *

path_to_file = sys.argv[1]
vertical_shrink = sys.argv[2]
horizontal_shrink = sys.argv[3]

# Read file
xmpfile = XMPFiles( file_path=path_to_file,
open_forupdate=files.XMP_OPEN_FORUPDATE)

# Get XMP from file.
xmp = xmpfile.get_xmp()

# Change the XMP property
xmp.set_property( "http://ns.somenamespace.com/1.0/";, 'vshrink',
vertical_shrink )
xmp.set_property( "http://ns.somenamespace.com/1.0/";, 'hshrink',
horizontal_shrink )


# Check if XMP document can be written to file and write it.
if xmpfile.can_put_xmp(xmp):
    xmpfile.put_xmp(xmp)

xmpfile.close_file()
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to