module win_installer.win_helper

Short summary

module pymyinstall.win_installer.win_helper

Helpers, inspired from utils.py

Functions

function truncated documentation
create_shortcut Create Windows shortcut (.lnk file)
decode_fs_string Convert string from file system charset to unicode
do_script Execute a script (get-pip typically)
exec_shell_cmd Execute shell command (args is a list of arguments) in path
get_env Return HKCU/HKLM environment variable name and value
get_gcc_version Return version of the GCC compiler installed in path
get_julia_version Return version of the Julia installed in path
get_python_infos Return (version, architecture) for the Python distribution located in path. The version number is limited to MAJOR.MINOR, ...
get_python_long_version Return long version (X.Y.Z) for the Python distribution located in path
get_r_version Return version of the R installed in path
get_rodeo_version Return version of the Rodeo installed in path
get_source_package_infos Return a tuple (name, version) of the Python source package
patch_shebang_line Remove absolute path to python.exe in shebang lines.
patch_sourcefile Replace a string in a source file
patch_sourcelines Replace the middle of lines between in_line_start and endline
python_query Execute Python command using the Python interpreter located in path
register Register a Python distribution in Windows registry
set_env Set HKCU/HKLM environment variables

Documentation

Helpers, inspired from utils.py

pymyinstall.win_installer.win_helper.create_shortcut(path, description, filename, arguments='', workdir='', iconpath='', iconindex=0)[source]

Create Windows shortcut (.lnk file)

Parameters:
  • path – where to store the link
  • description – description
  • filename – link name
  • arguments – arguments to store
  • workdir – working directory

@para iconpath icon

Parameters:iconindex – icon index
Returns:filename
pymyinstall.win_installer.win_helper.decode_fs_string(string)[source]

Convert string from file system charset to unicode

pymyinstall.win_installer.win_helper.do_script(this_script, python_exe=None, verbose=False, install_options=None)[source]

Execute a script (get-pip typically)

pymyinstall.win_installer.win_helper.exec_shell_cmd(args, path)[source]

Execute shell command (args is a list of arguments) in path

pymyinstall.win_installer.win_helper.get_env(name, current=True)[source]

Return HKCU/HKLM environment variable name and value

Parameters:
  • name – name to look for
  • current – switch between HKEY_CURRENT_USER (True) and HKEY_LOCAL_MACHINE (False)
Returns:

tuple (see below)

For example, get_user_env(‘PATH’) may returns:

('Path', u'C:\Program Files\Intel\WiFi\bin\')
pymyinstall.win_installer.win_helper.get_gcc_version(path)[source]

Return version of the GCC compiler installed in path

pymyinstall.win_installer.win_helper.get_julia_version(path)[source]

Return version of the Julia installed in path

pymyinstall.win_installer.win_helper.get_python_infos(path)[source]
Return (version, architecture) for the Python distribution located in
path. The version number is limited to MAJOR.MINOR, the architecture is an integer: 32 or 64
pymyinstall.win_installer.win_helper.get_python_long_version(path)[source]
Return long version (X.Y.Z) for the Python distribution located in
path
pymyinstall.win_installer.win_helper.get_r_version(path)[source]

Return version of the R installed in path

pymyinstall.win_installer.win_helper.get_rodeo_version(path)[source]

Return version of the Rodeo installed in path

pymyinstall.win_installer.win_helper.get_source_package_infos(fname)[source]

Return a tuple (name, version) of the Python source package

pymyinstall.win_installer.win_helper.patch_shebang_line(fname, pad=b' ', fLOG=<built-in function print>)[source]

Remove absolute path to python.exe in shebang lines.

Parameters:
  • python – python extractor
  • pad – pad
  • fLOG – logging function
Returns:

boolean, True if patched, False otherwise

pymyinstall.win_installer.win_helper.patch_sourcefile(fname, in_text, out_text, silent_mode=False)[source]

Replace a string in a source file

pymyinstall.win_installer.win_helper.patch_sourcelines(fname, in_line_start, out_line, endline='\n', silent_mode=False)[source]

Replace the middle of lines between in_line_start and endline

pymyinstall.win_installer.win_helper.python_query(cmd, path)[source]

Execute Python command using the Python interpreter located in path

pymyinstall.win_installer.win_helper.register(target, current=True)[source]

Register a Python distribution in Windows registry

pymyinstall.win_installer.win_helper.set_env(name, value, current=True)[source]

Set HKCU/HKLM environment variables

Parameters:
  • name – name to look for
  • current – switch between HKEY_CURRENT_USER (True) and HKEY_LOCAL_MACHINE (False)