Skip to content

Latest commit

 

History

History
177 lines (143 loc) · 4.24 KB

README.md

File metadata and controls

177 lines (143 loc) · 4.24 KB

Installerator

"It mostly works™"

License: WTFPL

A small Python module that makes installing Python apps easier

Requirements

This app also requires one additional library:
Configurator
See it's repo for installation instructions.

Installing

You should first run:

foo@bar:~$ sudo apt update && sudo apt upgrade

to make sure you have the lastest software installed.

You can download the (hopefully stable) latest release from the main branch.
Download the Source Code (tar.gz) file.
Then install it using:

foo@bar:~$ cd Downloads
foo@bar:~/Downloads$ python -m pip install Installerator-X.X.X.tar.gz

Or you can clone the git repo to get the latest (and often broken) code from the dev branch:

foo@bar:~$ python -m pip install build
foo@bar:~$ cd Downloads
foo@bar:~/Downloads$ git clone https://github.com/cyclopticnerve/Installerator
foo@bar:~/Downloads$ cd Installerator
foo@bar:~/Downloads/Installerator$ python -m build
foo@bar:~/Downloads/Installerator$ python -m pip install ./dist/installerator-X.X.X.tar.gz -r ./requirements.txt

Uninstalling

python -m pip uninstall installerator

Usage

Install.py:

# from <package>.<module> import <Class>
from installerator.installerator import Installerator

# NB: configurator's dict_defs and dict_subs are hard coded
# so the only thing we need is dict_user

# the user dict
dict_user = {
    "general": {
        "name": "SpaceOddity"
    },
    "py_reqs": [
        "python-crontab"
    ],
    "dirs": [
        "${HOME}/.spaceoddity",
        "${HOME}/.config/spaceoddity"
    ],
    "files": {
        "${SRC}/spaceoddity.py": "${HOME}/.spaceoddity",
        "${SRC}/LICENSE": "${HOME}/.spaceoddity",
        "${SRC}/VERSION": "${HOME}/.spaceoddity",
        "${SRC}/uninstall.py": "${HOME}/.spaceoddity",
        "${SRC}/uninstall.json": "${HOME}/.spaceoddity",
        "${SRC}/cron_uninstall.py": "${HOME}/.spaceoddity"
    },
    "postflight": [
        "${SRC}/convert_json.py",
        "${SRC}/cron_install.py",
        "${HOME}/.spaceoddity/spaceoddity.py"
    ]
}

# create an instance of the class
inst = Installerator()

# # run the instance
inst.run(dict_user)

Uninstall.py:

# from <package>.<moule> import <Class>
from installerator.uninstallerator import Uninstallerator 

# NB: configurator's dict_defs and dict_subs are hard coded
# so the only thing we need is dict_user

# the user dict
dict_user = {
    "general": {
        "name": "SpaceOddity"
    },
    "preflight": [
        "${HOME}/.spaceoddity/cron_uninstall.py"
    ],
    "dirs": [
        "${HOME}/.spaceoddity",
        "${HOME}/.config/spaceoddity"
    ]
}

# create an instance of the class
uninst = Uninstallerator()

# # run the instance
uninst.run(dict_user)

Notes

Currently, dict_defs and dict_subs are hard-coded to what the lib expects. This may change in future releases. The dict_def looks like this (note which values are dicts, and which are arrays):

dict_defs = {
    'general': {
        'name':    ''
    },
    'preflight': [
    ],
    'sys_reqs': [
    ],
    'py_reqs': [
    ],
    'dirs': [
    ],
    'files': {
    },
    'postflight': [
    ]
}

And the dict_subs looks like this:

# get current user's home dir
home_dir = os.path.expanduser('~')

# get location
src_dir = os.path.dirname(os.path.abspath(__file__))

# the default dict of substitutions
dict_subs = {
    '${HOME}': home_dir,
    '${SRC}': src_dir
}

-)