Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Packaging script source files in IronPython and IronRuby

Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find the embedded resources?

like image 716
Scott Holden Avatar asked Jun 20 '26 11:06

Scott Holden


1 Answers

You could add custom import hook that looks for embedded resources when an import is executed. This is slightly complex and probably not worth the trouble.

A better technique would be to fetch all of the embedded modules at startup time, execute them with the ScriptEngine and put the modules you have created into the sys.modules dictionary associated with the engine. This automatically makes them available for import by Python code executed by the engine.

like image 120
fuzzyman Avatar answered Jun 21 '26 23:06

fuzzyman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!