module win_installer.win_helper

Short summary

module pymyinstall.win_installer.win_helper

Helpers, inspired from utils.py

source on GitHub

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_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

source on GitHub

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

source on GitHub

pymyinstall.win_installer.win_helper.decode_fs_string(string)[source]

Convert string from file system charset to unicode

source on GitHub

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

Execute a script (get-pip typically)

source on GitHub

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

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

source on GitHub

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\')

source on GitHub

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

Return version of the GCC compiler installed in path

source on GitHub

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

Return version of the Julia installed in path

source on GitHub

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

source on GitHub

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

Return long version (X.Y.Z) for the Python distribution located in path

source on GitHub

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

Return version of the R installed in path

source on GitHub

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

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

source on GitHub

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

source on GitHub

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

Replace a string in a source file

source on GitHub

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

source on GitHub

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

Execute Python command using the Python interpreter located in path

source on GitHub

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

Register a Python distribution in Windows registry

source on GitHub

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)

source on GitHub