Package: zensols.install
Downloads and installs filesSimple light API to download and install files.  If the file appears to be a
compressed file by ending withzip,tar.gz,tgzetc, then also un-compress
the file after it is downloaded.  The process flow follows:Check to see if the installed file exists.  If not download it.Otherwise, if the file has been downloaded uncompress it.If the file could not be downloaded, uncompressed, or a file from the
uncompressed file isn't found an error is thrown.A destination location can be specified in the configuration.  It is also
possible to install it in the~/.cache/<package name>wherepackage nameis
the name the installed package.  For example, that would bezensols.installfor the package installed for this repository.DocumentationFull documentationAPI referenceObtainingThe easiest way to install the command line program is via thepipinstaller:pip3installzensols.installBinaries are also available onpypi.UsageThe below code is given in theexample.First create the installer configuration with each file to be installed as a
resource as a fileinstall.conf:[zip_resource]class_name=zensols.install.Resourceurl=https://github.com/plandes/zenbuild/archive/refs/tags/general_build.zip# we have to give the name of the diretory in the zip file so the program knows# what to unzip; otherwise it is named from the section, or file if `None`name=zenbuild-general_build# uncomment below to keep the `zenbuild-general_build.zip` zip file#clean_up = False[downloader]class_name=zensols.install.Downloader#use_progress_bar = False[installer]class_name=zensols.install.Installerdownloader=instance: downloader# uncomment the below line, then comment out `base_directory` to use the# package name (using the zensols.cli.ApplicationFactory--see example); using# `package_resource` will in install a ~/.<package name> install directorybase_directory=path: install_dir#package_resource = ${package:name}resources=instance: list: zip_resourceNow use the configuration to create the installer and call it:importloggingfromzensols.configimportIniConfig,ImportConfigFactoryfromzensols.installimportInstallerlogging.basicConfig(level=logging.INFO)fac=ImportConfigFactory(IniConfig('install.conf'))installer:Installer=fac.instance('installer')installer.install()This code creates a new directory with the un-zipped files ininstall_dir:INFO:zensols.install.installer:installing zenbuild-general_build to install_dir/zenbuild-general_build
INFO:zensols.install.download:creating directory: install_dir
INFO:zensols.install.download:downloading https://github.com/plandes/zenbuild/archive/refs/tags/general_build.zip to install_dir/zenbuild-general_build.zip
general_build.zip: 16.4kB [00:00, 40.1kB/s]
INFO:zensols.install.installer:uncompressing install_dir/zenbuild-general_build.zip to install_dir
patool: Extracting install_dir/zenbuild-general_build.zip ...
patool: ... install_dir/zenbuild-general_build.zip extracted to `install_dir'.
INFO:zensols.install.installer:cleaning up downloaded file: install_dir/zenbuild-general_build.zipFirst the program checks to see if the target directory (nameproperty in thezip_resourcesection) exists.  It then downloads it when it can't find either
the target directory or the downloaded file.If the program is run a second time, there will be no output since the
installed directory now exists.ChangelogAn extensive changelog is availablehere.LicenseMIT LicenseCopyright (c) 2021 - 2023 Paul Landes