[IronPython] Application?

Dino Viehland dinov at exchange.microsoft.com
Thu Aug 2 18:42:58 CEST 2007


Ahh, I see.  It looks like this info ultimately comes from custom attributes exposed off of Assembly.GetEntryAssembly().  Therefore w/ the VS SDK sample (which I assume is where the VS side of things come in) and the IronPython command line these are both going to reflect the hosting app.

It would be theoretically possible to do this w/ the pyc sample and some changes to the PythonCompiler class.  The PythonCompiler class would need to expose the AssemblyGen object and set the appropriate custom attributes on it via, something like:

ag.myAssembly.SetCustomAttribute(new CustomAttributeBuilder(
               typeof(AssemblyInformationalVersionAttribute).GetConstructor(new Type[]{typeof(string)}), "2.0")
               );

That has the downside of requiring you to compile your code (or at least your main EXE).  But basically it looks like we have no good support for this right now.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Davy Mitchell
Sent: Thursday, August 02, 2007 1:05 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Application?

Thanks Dino.

Yes the Application does work but all the paths point to the
PythonConsoleHost folder name and version so are not much use.

The version and app name seem to be set in AssemblyInfo file in a VS
project. Is this achievable with IronPython?

Thanks,
Davy

On 8/2/07, Dino Viehland <dinov at exchange.microsoft.com> wrote:
> This works for me:
>
> >>> import System
> >>> import clr
> >>> clr.AddReference('System.Windows.Forms')
> >>> from System.Windows.Forms import Application
> >>> dir(Application)
> ['AddMessageFilter', 'AllowQuit', 'ApplicationExit', 'CommonAppDataPath', 'CommonAppDataRegistry', 'CompanyName', 'CurrentCulture', 'CurrentInputLanguage',
>  'DoEvents', 'EnableVisualStyles', 'EnterThreadModal', 'Equals', 'ExecutablePath', 'Exit', 'ExitThread', 'FilterMessage', 'Finalize', 'GetHashCode', 'GetTy
> pe', 'Idle', 'LeaveThreadModal', 'LocalUserAppDataPath', 'MakeDynamicType', 'MemberwiseClone', 'MessageLoop', 'MessageLoopCallback', 'OleRequired', 'OnThre
> adException', 'OpenForms', 'ProductName', 'ProductVersion', 'RaiseIdle', 'Reduce', 'ReferenceEquals', 'RegisterMessageLoop', 'RemoveMessageFilter', 'Render
> WithVisualStyles', 'Restart', 'Run', 'SafeTopLevelCaptionFormat', 'SetCompatibleTextRenderingDefault', 'SetSuspendState', 'SetUnhandledExceptionMode', 'Sta
> rtupPath', 'ThreadException', 'ThreadExit', 'ToString', 'UnregisterMessageLoop', 'UseWaitCursor', 'UserAppDataPath', 'UserAppDataRegistry', 'VisualStyleSta
> te', '__class__', '__doc__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', 'add_ApplicationExit', 'add_EnterThreadModal',
>  'add_Idle', 'add_LeaveThreadModal', 'add_ThreadException', 'add_ThreadExit', 'remove_ApplicationExit', 'remove_EnterThreadModal', 'remove_Idle', 'remove_L
> eaveThreadModal', 'remove_ThreadException', 'remove_ThreadExit']
> >>> Application.CommonAppDataPath
> 'C:\\ProgramData\\Microsoft\\IronPython\\1.1'
> >>>
>
>
>
>
>
>
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Davy Mitchell
> Sent: Wednesday, August 01, 2007 3:34 PM
> To: Discussion of IronPython
> Subject: [IronPython] Application?
>
> Is there a way to use the Application namespace in IronPython?
>
> Hoping to use methods like Application.CommonAppDataPath but they all
> seem assembly focussed?
>
> Thanks,
> Davy
>
> --
> Davy Mitchell
> Blog - http://www.latedecember.co.uk/sites/personal/davy/
> Twitter - http://twitter.com/daftspaniel
> Skype - daftspaniel
> needgod.com
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>


--
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel
needgod.com
_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list