module installcustom.install_custom_python

Short summary

module pymyinstall.installcustom.install_custom_python

Various functions to install python.

source on GitHub

Functions

function

truncated documentation

_clean_err0

_clean_err1

fix_fcntl_windows

Adds a file fnctl.py on Windows (only available on Linux).

fix_resource_windows

Adds a file resource.py on Windows (only available on Linux).

fix_termios_windows

Adds a file termios.py on Windows (only available on Linux).

folder_older_than

Tells if a folder is older than a given timespan.

install_python

Installs python. It does not do it a second time if it is already installed.

unzip7_files

If 7z is installed, the function uses it to uncompress file into 7z format. The file filename_7z

Documentation

Various functions to install python.

source on GitHub

pymyinstall.installcustom.install_custom_python._clean_err0(err)
pymyinstall.installcustom.install_custom_python._clean_err1(err)
pymyinstall.installcustom.install_custom_python.fix_fcntl_windows(path)

Adds a file fnctl.py on Windows (only available on Linux).

Parameters:

path – path to the python installation

source on GitHub

pymyinstall.installcustom.install_custom_python.fix_resource_windows(path)

Adds a file resource.py on Windows (only available on Linux).

Parameters:

path – path to the python installation

source on GitHub

pymyinstall.installcustom.install_custom_python.fix_termios_windows(path)

Adds a file termios.py on Windows (only available on Linux).

Parameters:

path – path to the python installation

source on GitHub

pymyinstall.installcustom.install_custom_python.folder_older_than(folder, delay=datetime.timedelta(days=30))

Tells if a folder is older than a given timespan.

Parameters:
  • folder – folder name

  • delay – delay

Returns:

boolean

source on GitHub

pymyinstall.installcustom.install_custom_python.install_python(temp_folder='.', fLOG=<built-in function print>, install=True, force_download=False, version=None, modules=None, custom=False, latest=False, download_folder='download', verbose=False, make_first=False)

Installs python. It does not do it a second time if it is already installed.

Parameters:
  • temp_folder – where to download the setup

  • fLOG – logging function

  • install – install (otherwise only download)

  • force_download – force the downloading of python

  • version – version to download (by default the current version of Python)

  • modules – modules to install

  • custom – the standalone distribution has issue when installing new packages, custom is True means switching to a zip of the standard distribution, see below

  • latest – install this version of pymyinstall and not the pypi version

  • download_folder – download folder for packages

  • verbose – more display

  • make_first – run make before make altinstall

Returns:

temporary file

The version is fixed to the current version of Python and amd64. The standalone distribution has an issue and raises an error for some packages such as smart_open:

error: [Errno 2] No such file or directory: '<python>\python36.zip\lib2to3\Grammar.txt'

In that case, you should consider using custom=True. The function work for Linux too. List of steps done in linux:

mkdir install_folder
cd install_folder
curl -O https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
tar xzf Python-3.7.2.tgz
mkdir dist372
cd Python-3.7.2/
# current folder is /home/dupre/temp/temp_py/dist372/
./configure --enable-optimizations --with-ensurepip=install --prefix=/home/dupre/temp/temp_py/dist372/inst --exec-prefix=/home/dupre/temp/temp_py/dist372/bin --datadir=/home/dupre/temp/temp_py/dist372/data

source on GitHub

pymyinstall.installcustom.install_custom_python.unzip7_files(filename_7z, fLOG=<built-in function print>, dest='.')

If 7z is installed, the function uses it to uncompress file into 7z format. The file filename_7z must not exist.

Parameters:
  • filename_7z – final destination

  • fLOG – logging function

  • dest – destination folder

Returns:

output of 7z

New in version 1.1.

source on GitHub