def __init__(self, config_path, config_dict, tmpdir=None, bin_root=None, dry_run=False, logger=None): """ Initializer for ExtensionEngine. Args: config_path (str): Path to the configuration file. For example, something like /home/weewx/weewx.conf) config_dict (str): The configuration dictionary, i.e., the contents of the file at config_path. tmpdir (str): A temporary directory to be used for extracting tarballs and the like [Optional] bin_root (str): Path to the location of the weewx binary files. For example, something like /home/weewx/bin. Optional. If not specified, it will be guessed based on the location of this file. dry_run (bool): If Truthy, all the steps will be printed out, but nothing will actually be done. logger (weecfg.Logger): An instance of weecfg.Logger. This will be used to print things to the console. """ self.config_path = config_path self.config_dict = config_dict self.logger = logger or Logger() self.tmpdir = tmpdir or '/var/tmp' self.dry_run = dry_run self.root_dict = weecfg.extract_roots(self.config_path, self.config_dict, bin_root) self.logger.log("root dictionary: %s" % self.root_dict, 4)
this_file = os.path.join(os.getcwd(), __file__) this_dir = os.path.abspath(os.path.dirname(this_file)) bin_dir = os.path.abspath(os.path.join(this_dir, 'bin')) # Now that we've found the bin subdirectory, inject it into the path: sys.path.insert(0, bin_dir) # Now we can import some weewx modules import weewx VERSION = weewx.__version__ import weecfg.extension import weeutil.weeutil from weecfg import Logger logger = Logger(verbosity=1) start_scripts = [ 'util/init.d/weewx.bsd', 'util/init.d/weewx.debian', 'util/init.d/weewx.lsb', 'util/init.d/weewx.redhat', 'util/init.d/weewx.suse' ] # The default station information: stn_info = {'station_type': 'Simulator', 'driver': 'weewx.drivers.simulator'} # ============================================================================== # install # ==============================================================================
def __init__(self, logger=None): self.logger = logger or Logger()