ae.updater

application environment updater

this module is providing check functions running on app startup for easy deployment of Python application updates.

updater check functions

update any files on the destination machine with the help of the check functions check_moves() and check_overwrites().

the check function check_local_updates() checks if your deployment package contains a Python update script that will be executed (and only one time after an app update) on the next startup of your application.

for a temporary work-around or bug-fix you can deploy your application update with a bootstrap Python script which will be executed on every startup of your application. the detection and execution of such bootstrap script is done by the function check_local_bootstrap()-

the function check_all() combines all the above checks.

the following skeleton of a main app module demonstrates a typical usage of check_all():

from python_and_3rd_party_libs import ...
from ae.updater import check_all
from project_local_libs import ...

check_all()

app = WhatEverApp(app_name=...)
...
app.run_app()

replace the check_all() call with the needed check function(s) if your app only needs certain checks.

Note

make sure that the check function(s) get called before you initialize any app instances if you want to update ony config variables, like application status or user preferences.

..hint: more info you find in the doc-strings of each of the check functions.

Functions

check_all([copy_src_folder, …])

check all outstanding scripts to be executed and files to be moved/overwritten.

check_copies([src_folder, dst_folder])

check on new or missing files to be copied from src_folder to the dst_folder.

check_local_bootstraps()

check if ae_bootstrap script exists in the current working directory to be executed on app startup.

check_local_updates()

check if ae_updater script exists in the current working directory to be executed and deleted.

check_moves([src_folder, dst_folder])

check on missing files to be moved from src_folder to the dst_folder.

check_overwrites([src_folder, dst_folder])

check on files to be moved from the source directory and overwritten within the destination directory.

check_copies(src_folder='ae_updater_copies', dst_folder='')[source]

check on new or missing files to be copied from src_folder to the dst_folder.

Parameters
  • src_folder (str) – path to source folder/directory where the files get copied from. If not specified then COPIES_SRC_FOLDER_NAME will be used.

  • dst_folder (str) – path to destination folder/directory where the files get copied to. If not specified or if you pass an empty string then the user data/preferences path ({usr}) will be used.

Return type

List[str]

Returns

list of moved files, with their destination path.

check_moves(src_folder='ae_updater_moves', dst_folder='')[source]

check on missing files to be moved from src_folder to the dst_folder.

Parameters
  • src_folder (str) – path to source folder/directory where the files get moved from. If not specified then MOVES_SRC_FOLDER_NAME will be used. Please note that the source folder itself will neither be moved nor removed (but will be empty after the operation finished).

  • dst_folder (str) – path to destination folder/directory where the files get moved to. If not specified or if you pass an empty string then the user data/preferences path ({usr}) will be used.

Return type

List[str]

Returns

list of moved files, with their destination path.

check_overwrites(src_folder='ae_updater_overwrites', dst_folder='')[source]

check on files to be moved from the source directory and overwritten within the destination directory.

Parameters
  • src_folder (str) – path to source folder/directory where the files get moved from. If not specified then MOVES_SRC_FOLDER_NAME will be used. Please note that the source folder itself will neither be moved nor removed (but will be empty after the operation finished).

  • dst_folder (str) – path to destination folder/directory where the files get moved to. If not specified or if you pass an empty string then the user data/preferences path ({usr}) will be used.

Return type

List[str]

Returns

list of moved and possibly overwritten files, with their destination path.

check_local_updates()[source]

check if ae_updater script exists in the current working directory to be executed and deleted.

Return type

bool

Returns

return value (True) of executed run_updater method (if module&function exists), else False.

check_local_bootstraps()[source]

check if ae_bootstrap script exists in the current working directory to be executed on app startup.

Return type

bool

Returns

return value (True) of executed run_updater function (if module&function exists) else False.

check_all(copy_src_folder='', move_src_folder='', over_src_folder='', dst_folder='')[source]

check all outstanding scripts to be executed and files to be moved/overwritten.

Parameters
  • copy_src_folder (str) – path to source folder/directory where the files get copied from. if not specified or if you pass an empty string then COPIES_SRC_FOLDER_NAME will be used.

  • move_src_folder (str) – path to source folder/directory where the files get moved from. if not specified or if you pass an empty string then MOVES_SRC_FOLDER_NAME will be used.

  • over_src_folder (str) – path to source folder/directory where the files get moved from and overwritten to. if not specified then OVERWRITES_SRC_FOLDER_NAME will be used.

  • dst_folder (str) – path to destination folder/directory where the files get moved to. if not specified or if you pass an empty string then the user data/preferences path ({usr}) will be used.

Return type

List[str]

Returns

list of processed (copied, moved or overwritten) files, with their destination path.