|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
distributing jar files with distutilsHello all,
First off I just want to say how great my experience with Jython has been. Everything has worked transparently thus far and I have not had to yet post to the list. I have a java library that I am wrapping up with jython. I am using standard distutils stuff to distribute the jython wrappers as well as the jar files via a single egg. However I am having issues setting up the classpath at runtime. I would like avoid having the user manually set up the CLASSPATH before invoking jython. So my root __init__.py script manually updates sys.path. However this leads to some strange results when actually trying to access the java libs: ClassNotDefError and the like. My setup.py script that scoops up all the java libs as data_files: geotools_libs = ['lib/target/%s' % (f) for f in os.listdir('lib/target')] setup(name='geoscript', ... data_files=[('geotools', geotools_libs)] ) And then my __init__.py that attempts to modify sys.path: try: import org.geotools except ImportError: # try to find them import sys, os print __file__ libs = os.path.abspath(os.path.join(__file__, '../../lib/target')) if os.path.exists(libs): # round up all the libs and add them to the classpath for lib in os.listdir(libs): sys.path.append(os.path.join(libs,lib)) So I guess my question is can I do this? Is there any standard way or conventions for distributing jar files? Thanks kindly, -Justin ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
Re: distributing jar files with distutilsOn Sat, Oct 24, 2009 at 5:40 PM, Justin Deoliveira <jdeolive@...> wrote:
> Hello all, > > First off I just want to say how great my experience with Jython has > been. Everything has worked transparently thus far and I have not had to > yet post to the list. > > I have a java library that I am wrapping up with jython. I am using > standard distutils stuff to distribute the jython wrappers as well as > the jar files via a single egg. > > However I am having issues setting up the classpath at runtime. I would > like avoid having the user manually set up the CLASSPATH before invoking > jython. So my root __init__.py script manually updates sys.path. However > this leads to some strange results when actually trying to access the > java libs: ClassNotDefError and the like. Do you have an stacktrace at hand? It could be a class-loader problem and I'm (albeit slowly) trying to clean up that area of Jython. > My setup.py script that scoops up all the java libs as data_files: > > geotools_libs = ['lib/target/%s' % (f) for f in os.listdir('lib/target')] > setup(name='geoscript', > ... > data_files=[('geotools', geotools_libs)] > ) > > And then my __init__.py that attempts to modify sys.path: > > try: > import org.geotools > except ImportError: > # try to find them > import sys, os > print __file__ > libs = os.path.abspath(os.path.join(__file__, '../../lib/target')) > if os.path.exists(libs): > # round up all the libs and add them to the classpath > for lib in os.listdir(libs): > sys.path.append(os.path.join(libs,lib)) > > So I guess my question is can I do this? Is there any standard way or > conventions for distributing jar files? I'm not sure if you have seen the announcements from Olli about Jump, his project to make it easy to distribute Jython apps. I haven't tried it yet but it looks promising Regards, -- Leo Soto M. http://blog.leosoto.com ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
Re: distributing jar files with distutilsHi,
Thanks for the reply. You are indeed correct that it was a class loader issue. Digging a bit deeper I found my problem already has a bug report open for it: http://bugs.jython.org/issue1373 As described on the issue I refactored SyspathJavaLoader a bit and it fixes my problem. However following the "how to submit a patch" guidelines leads me here: http://jython.org/patches/ But I get a 404. Is the patch tracker down? Or are the patch guidelines out of date? And about Jump it looks *very* promising. I will definitely be looking into that for distribution of my app. Thanks for the tip. -Justin Leo Soto M. wrote: > On Sat, Oct 24, 2009 at 5:40 PM, Justin Deoliveira <jdeolive@...> wrote: >> Hello all, >> >> First off I just want to say how great my experience with Jython has >> been. Everything has worked transparently thus far and I have not had to >> yet post to the list. >> >> I have a java library that I am wrapping up with jython. I am using >> standard distutils stuff to distribute the jython wrappers as well as >> the jar files via a single egg. >> >> However I am having issues setting up the classpath at runtime. I would >> like avoid having the user manually set up the CLASSPATH before invoking >> jython. So my root __init__.py script manually updates sys.path. However >> this leads to some strange results when actually trying to access the >> java libs: ClassNotDefError and the like. > > Do you have an stacktrace at hand? It could be a class-loader problem > and I'm (albeit slowly) trying to clean up that area of Jython. > >> My setup.py script that scoops up all the java libs as data_files: >> >> geotools_libs = ['lib/target/%s' % (f) for f in os.listdir('lib/target')] >> setup(name='geoscript', >> ... >> data_files=[('geotools', geotools_libs)] >> ) >> >> And then my __init__.py that attempts to modify sys.path: >> >> try: >> import org.geotools >> except ImportError: >> # try to find them >> import sys, os >> print __file__ >> libs = os.path.abspath(os.path.join(__file__, '../../lib/target')) >> if os.path.exists(libs): >> # round up all the libs and add them to the classpath >> for lib in os.listdir(libs): >> sys.path.append(os.path.join(libs,lib)) >> >> So I guess my question is can I do this? Is there any standard way or >> conventions for distributing jar files? > > I'm not sure if you have seen the announcements from Olli about Jump, > his project to make it easy to distribute Jython apps. I haven't tried > it yet but it looks promising > > Regards, -- Justin Deoliveira OpenGeo - http://opengeo.org Enterprise support for open source geospatial. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
| Free embeddable forum powered by Nabble | Forum Help |