[x3d-public] X3D python language binding, pyjnius validation

John Carlson yottzumm at gmail.com
Tue Apr 9 07:27:46 PDT 2019


Don, if you think it’s best, please output the following 2 lines to a python configuration file (in PYTHONPATH) using ant (configuration target):  Call the pyjnius folder file classpath.py (should be present in the file system on next subversion update).
=======================================================================================
import jnius_config
jnius_config.set_classpath('.', 'c:/x3d-code/www.web3d.org/x3d/stylesheets/java/jars/X3DJSAIL.3.3.full.jar', '../../../jars/X3DJSAIL.3.3.full.jar')
=======================================================================================
If you like, you may include the value of ${env.CLASSPATH} in the set_classpath parameters, or override the parameters with the value of ${env.CLASSPATH}, just as long as my ant still works without setting CLASSPATH (desirable) from the pyjnius folder. My current values are programmed for Windows. Make sure the CLASSPATH and checked in classpath.py (without running ant) will work on other popular platforms.

Then we will have all configuration changes present in the build.xml’s. Is that the best design?

Curious.  If a python file bombs out, do we have some way of exiting the build? Do you kill the build with X3D-Edit? Task Manager? I can’t kill or interrupt an ant build with mintty/bash, even using kill.  That alone may cause me to move to an IDE.   What’s the name of netbeans vi/vim plugin?

We’re getting closer and closer to a good solution for configuration. we need to start looking at the python *.future.py problems now and spend less time on configurations.   We may just want to declare the *.future.py problems “impossible” or tell people to offer a solution to problems that crop up (after we show them the solution using an API that mere mortals can use), so we’ve got python programmers helping us.  First though, we can provide a working “non-future” API to them. In the short term, I recommend disabling generation of *.future.py files in xml2all.js, using //’s or /* */ to comment out the future.py conversion lines.

Do you have a good XML compare tool for comparing roundtrip XML to original XML? I can install xmldiff.js if you like. It requires xml2js. Xml2js LICENSE looks okay.  Are you already running comparisons?

Note that I am limiting my modifications to the python folder, jacoco, pyjnius and pythonapi subfolders, per our previous agreement about keeping development to the nashorn folder. I don’t think you want an non-ant programmer messing with your builds.

Thanks,

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Tuesday, April 9, 2019 8:12 AM
To: Brutzman, Donald (Don) (CIV)
Cc: X3D Graphics public mailing list
Subject: RE: X3D python language binding, pyjnius validation

Here’s what the documentation says:

https://pyjnius.readthedocs.io/en/stable/api.html

“If a classpath is set with these functions, it overrides any CLASSPATH environment variable. Multiple options or path entries should be supplied as multiple arguments to the add_ and set_functions. If no classpath is provided and CLASSPATH is not set, the path defaults to ‘.’. This functionality is not available on Android.”

Well, I set CLASSPATH, so there’s likely some problem with how we are setting CLASSPATH?  IDK, I’ve tried a couple of ways.  What we could do is the absolute path to pyjnius in the PYTHONPATH, then append ../../../jars/X3DJSAIL.jar (not fully specified) to it.

Another thing we might try is outputting the CLASSPATH variable from Ant to a configuration file, then reading that file in autoclass.py and X3Dautoclass.py.

What do you think is best?  What’s least confusing?  Why can’t pyjnius work as is documented?

Sent from Mail for Windows 10

From: John Carlson
Sent: Tuesday, April 9, 2019 7:59 AM
To: Brutzman, Donald (Don) (CIV)
Cc: X3D Graphics public mailing list
Subject: RE: X3D python language binding, pyjnius validation

I must be an idiot user.  No luck removing set_classpath.  You would think that by default, pyjnius would grab the CLASSPATH from the environment.

Hmm.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Tuesday, April 9, 2019 7:50 AM
To: Brutzman, Donald (Don) (CIV)
Cc: X3D Graphics public mailing list
Subject: RE: X3D python language binding, pyjnius validation

How well is setting CLASSPATH environmental variable working for you?   I couldn’t get that to work with pyjnius, I think pyjnius has it’s own internal setting.   That’s what I’ve gotten working. Please examine last few lines of autoclass.py to add your changes to classpath. I haven’t found the perfect solution, but I suggest we grab the CLASSPATH from the environment in autoclass.py and use that value to split and send to jnius_config.set_classpath, if we can spread out an array to arguments to set_classpath.

Here’s what appears possible.  Note that Android users will have to do something different.

https://stackoverflow.com/questions/41353826/how-to-use-my-java-class-in-kivy-app-using-kivy-launcher

Note that setting the classpath in autoclass.py overrides any attempt to set a CLASSPATH external or internal to ant.  I believe that’s mentioned in links off the above one.

Yes, I have tried getting rid of the setting in autoclass.py and X3Dautoclass.py, and can try again setting a external CLASSPATH if you like. Let me know.  Or try to duplicate the problem.  I really don’t like setting the CLASSPATH in python, but it will help idiot users who really want to set their CLASSPATH and we don’t know their system looks like.

I think I’ll try again.

John
Sent from Mail for Windows 10

From: John Carlson
Sent: Tuesday, April 9, 2019 7:28 AM
To: Brutzman, Donald (Don) (CIV)
Cc: X3D Graphics public mailing list
Subject: RE: X3D python language binding, pyjnius validation

I updated X3Dautoclass.py in svn.   Should not have any effect on standard build, if you’ve done it. Changes from autoclass.py should already be there from a previous checkout and build.

John





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190409/506d0912/attachment.html>


More information about the x3d-public mailing list