As an FYI, the following change was made from the IP 2.6 version of pyc.py to the IP 2.7 version (newer version shown first):<br><br>< # get the ScriptCode assembly...<br>< gen.EmitCall(OpCodes.Call, clr.GetClrType(Assembly).GetMethod("GetEntryAssembly"), ())<br>
< gen.EmitCall(OpCodes.Callvirt, clr.GetClrType(Assembly).GetMethod("get_Location"), ())<br>---<br>> # get the ScriptCode assembly...<br>> gen.EmitCall(OpCodes.Call, clr.GetClrType(Assembly).GetMethod("GetEntryAssembly"), ());<br>
> gen.EmitCall(OpCodes.Call, clr.GetClrType(Assembly).GetMethod("get_CodeBase"), ());<br>> gen.Emit(OpCodes.Newobj, clr.GetClrType(System.Uri).GetConstructor( (str, ) ));<br>> gen.EmitCall(OpCodes.Call, clr.GetClrType(System.Uri).GetMethod("get_LocalPath"), ());<br>
<br>Don't know what these things do at this point, but wondering if the changes have to do with compiling the entire code tree into the application .DLL???<br>Ken<br><br><div class="gmail_quote">On Wed, Oct 6, 2010 at 4:04 PM, Ken MacDonald <span dir="ltr"><<a href="mailto:drken567@gmail.com">drken567@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Dino,<br><br><div class="gmail_quote"><div class="im">On Wed, Oct 6, 2010 at 2:57 PM, Dino Viehland <span dir="ltr"><<a href="mailto:dinov@microsoft.com" target="_blank">dinov@microsoft.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">How are you distributing your app? I’m assuming you’re going to have something like:</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">MyApp\</span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">MyApp.exe</span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">MyApp.dll</span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">IronPython.dll</span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">IronPython.Modules.DLL</span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">…</span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p></div></div></blockquote></div><div>This is exactly how we have been distributing our app up to IP 2.6 with .NET 3.5. We also have another DLL with our resources in it; XAML, icons, image files, but no code per se. We have been distributing it this way to customer systems that do NOT have IronPython installed, or any sign of the std. library, or "os.py" specifically, and it's been working really, really well.<br>
<br>We're trying to understand what changed moving to IP 2.7 and .NET 4.0 that we should have to care about distributing the std. library now. The way it was before was quite simple and robust; deliver a small handful of files and it just worked, very easy to keep track of. Now instead of distributing 5 files, we suddenly need to distribute 500??? We've figured out that it certainly COULD work as described below, but it seems like a giant step backwards on several fronts, including the potential for folks to maliciously or accidentally tamper with the std lib. sources and affect the functioning of our app. So, how do we get back to the old/better functionality?<br>
<br>On a <i>slightly </i>related note, our app imports some package directories in addition, e.g. "import ctypes". When python encounters a directory import, it looks for __init__.py in the directory, and derives the package import directions from there, as I understand it. However, I can't specify the "ctypes" directory as an argument to the pyc.py compile app; just causes it to croak. If I explicitly specified paths like "lib\ctypes\__init__.py" and the other files in the ctypes subdirectory, it seems like "import ctypes" would have no clue that the __init__.py that was compiled in had anything to do with the "ctypes" package, as the path names are presumably irrelevant to the compiler as long as they specify a python file. I'm considering mod'ing pyc.py to be able to incorporate a list of std lib modules to compile in: simple enough for the standalone files like "os.py", but the compile modules don't seem to be able to grok what to do with a package subdirectory.<br>
<font color="#888888">
Ken<br> </font></div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">You should be able to also distribute the standard library and just drop it into a Lib directory next to IronPython.dll:</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">MyApp\</span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">MyApp.exe</span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">MyApp.dll</span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">IronPython.dll</span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">IronPython.Modules.DLL</span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">…</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> Lib\</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> os.py</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">That lib dir should be on sys.path at startup and so it should be available for importing.</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-width: medium medium medium 1.5pt; border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; padding: 0in 0in 0in 4pt;">
<div>
<div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; padding: 3pt 0in 0in;">
<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a>]
<b>On Behalf Of </b>Ken MacDonald<br>
<b>Sent:</b> Wednesday, October 06, 2010 11:42 AM<br>
<b>To:</b> Michael Foord<div><br>
<b>Cc:</b> Discussion of IronPython<br>
<b>Subject:</b> Re: [IronPython] change in standard library behavior for compiled .exe/.dll???</div></span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p class="MsoNormal" style="margin-bottom: 12pt;">Hi Michael,</p><div><div></div><div><br>
I started out on implementing this, but I am importing maybe a dozen of the std. library modules, which then import others, and so on. It appears that eventually, most of the std modules would have to be imported explicitly (perhaps 400 or so files) which might
make for a somewhat cumbersome command line, incidentally also about 20K characters too long :-). I'm hoping to find a way to get this to work as well as it did under IP 2.5 / .NET 3.5.<br>
<br>
Noah: what kind of problems are YOU having with pyc.py under 4.0? Maybe one of us can suggest something if we have an understanding of what you're trying to do.<br>
Ken</div></div><div><div></div><div>
<div>
<p class="MsoNormal">On Wed, Oct 6, 2010 at 7:08 AM, Michael Foord <<a href="mailto:michael@voidspace.org.uk" target="_blank">michael@voidspace.org.uk</a>> wrote:</p>
<div>
<div>
<p class="MsoNormal">On 05/10/2010 22:27, Ken MacDonald wrote: </p>
<p class="MsoNormal">I've been looking at the .exe's we built - using pyc.py - with IP 2.5/.Net 3.5 and IP2.7 / .NET 4.0. In the 2.7 .exe, it appears that the imports (like "os") are not being built into the .exe/.dll, but instead are required to be imported
in source form, e.g. "os.py" must be somewhere on sys.path. In the IP 2.5 .exe's we had been building, they would run fine on machines without the IP standard library installed at all, in other words, with "os.py" not present on the machine at all. We did
notice that the .exe in question went from being 2.9 MB in it's IP 2.5 incarnation, down to 1.2 MB in the IP 2.7 version, and the newer version requires that the source code for the IP standard library be on the path. Is this a deliberate change in behavior?
We never had to package the standard library source when we sent out .exe's to customers before</p>
<p class="MsoNormal"> </p>
</div>
<p class="MsoNormal">Hmmm... I'm pretty sure I always had to explicitly compile and bundle the standard library with previous versions of Python. Odd. Anyway, the simple solution is to ensure that you add any standard library modules you use to the set you
compile and ship.</p>
<div>
<div>
<p class="MsoNormal"><br>
<br>
All the best,<br>
<br>
Michael Foord<br>
<br>
<br>
<br>
</p>
<p class="MsoNormal"><br>
>"os" is not an assembly but a Python module from the standard library. You need to ensure >that the Python standard library (or the parts that you use and their dependencies) is on the >path.</p>
<div>
<blockquote style="border-width: medium medium medium 1pt; border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204, 204); padding: 0in 0in 0in 6pt; margin-left: 4.8pt; margin-right: 0in;">
<div>
<p class="MsoNormal"><br>
All the best,<br>
<br>
Michael Foord<br>
<br>
<br>
</p>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;">and how do I ensure it gets found from my .exe - is there a specific env. variable, or the Windows %PATH% e.v., or something I haven't AddReference'd to????<br>
Thanks,<br>
Ken<br>
<br>
</p>
</div>
<pre> </pre>
<pre>_______________________________________________</pre>
<pre>Users mailing list</pre>
<div>
<pre><a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a></pre>
<pre><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a></pre>
</div>
<p class="MsoNormal"><br>
<br>
<br>
</p>
<pre>-- </pre>
<pre><a href="http://www.voidspace.org.uk/blog" target="_blank">http://www.voidspace.org.uk/blog</a></pre>
<pre> </pre>
<pre>READ CAREFULLY. By accepting and reading this email you agree,</pre>
<pre>on behalf of your employer, to release me from all obligations</pre>
<pre>and waivers arising from any and all NON-NEGOTIATED agreements,</pre>
<pre>licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,</pre>
<pre>confidentiality, non-disclosure, non-compete and acceptable use</pre>
<pre>policies (”BOGUS AGREEMENTS”) that I have entered into with your</pre>
<pre>employer, its partners, licensors, agents and assigns, in</pre>
<pre>perpetuity, without prejudice to my ongoing rights and privileges.</pre>
<pre>You further represent that you have the authority to release me</pre>
<pre>from any BOGUS AGREEMENTS on behalf of your employer.</pre>
</div>
</blockquote>
</div>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><br>
<br>
<br>
</p>
<pre>-- </pre>
<pre><a href="http://www.voidspace.org.uk/blog" target="_blank">http://www.voidspace.org.uk/blog</a></pre>
<pre> </pre>
<pre>READ CAREFULLY. By accepting and reading this email you agree,</pre>
<pre>on behalf of your employer, to release me from all obligations</pre>
<pre>and waivers arising from any and all NON-NEGOTIATED agreements,</pre>
<pre>licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,</pre>
<pre>confidentiality, non-disclosure, non-compete and acceptable use</pre>
<pre>policies (”BOGUS AGREEMENTS”) that I have entered into with your</pre>
<pre>employer, its partners, licensors, agents and assigns, in</pre>
<pre>perpetuity, without prejudice to my ongoing rights and privileges.</pre>
<pre>You further represent that you have the authority to release me</pre>
<pre>from any BOGUS AGREEMENTS on behalf of your employer.</pre>
</div>
</div>
</div>
</div>
<p class="MsoNormal"> </p>
</div></div></div>
</div>
</div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></div></div></div><br>
</blockquote></div><br>