[Automatic Script Creation] the entry_points on Windows

This post just focuses on the entry_points on Windows platform, which is learned from setuptools. Different from POSIX, there are two entry_points – ‘console_scripts’ and ‘gui_scripts’ for windows.

Besides the things done in ‘console_scripts’ on POSIX, three extra things should be done on windows:

1.    match the correct extension and laucher for different entry_point
     1) string example:
    for gui_scripts: ext, launcher = ‘-script.pyw’, ‘gui.exe’
    for console_scripts: ext, launcher = ‘-script.py’, ‘cli.exe’
     2) reference in setuptools:
     lines in get_script_args() function
     3) need entry_points or pkg_resource support ?
     no
     4) consideration:
     On windows, setuptools always use a laucher (gui.exe or cli.exe) to lauch a file, it may need some improvements as people say on the bug tracker.

2.    get the resource string when creating .exe file
     1) string example:
     yield (name+’.exe’, resource_string(‘setuptools’, launcher),’b’)
     2) reference in setuptools:
     lines in get_script_args() function;
    the resource_string() function of setuptools
     3) need entry_points or pkg_resource support ?
     Yes
     4) consideration:
     how to get the resource string without pkg_resource there? Is it necessary?

3.    generate the manifest string when creating .exe file
     1) string example:
_launcher_manifest = “””
<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>
<assembly xmlns=”urn:schemas-microsoft-com:asm.v1″ manifestVersion=”1.0″>
 <assemblyIdentity version=”1.0.0.0″
 processorArchitecture=”X86″
 name=”%s.exe”
 type=”win32″/>

 <!– Identify the application security requirements. –>
 <trustInfo xmlns=”urn:schemas-microsoft-com:asm.v3″>
 <security>
 <requestedPrivileges>
 <requestedExecutionLevel level=”asInvoker” uiAccess=”false”/>
 </requestedPrivileges>
 </security>
 </trustInfo>
</assembly>”””
     2) reference in setuptools:
     lines in get_script_args() function;
     the global ‘_launcher_manifest‘ variable in Easy_install.py
     3) need entry_points or pkg_resource support ?
     No.
     4) consideration:
     I’m not sure what’s the usage of this manifest string and if it will need some changes in future packaging.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s