コード例 #1
0
ファイル: test_testnet.py プロジェクト: stjordanis/elrond-sdk
def test_init():
    data = dict()
    data['folders'] = {
        'elrond_go': '{ELRONDSDK}/bar',
        'elrond_proxy_go': '{ELRONDSDK}/foobar',
        'testnet': '/some/where/mytestnet',
    }

    testnet_config = config.TestnetConfiguration(data)
    assert testnet_config.config["folders"][
        "elrond_go"] == workstation.get_tools_folder() / "bar"
    assert testnet_config.config["folders"][
        "elrond_proxy_go"] == workstation.get_tools_folder() / "foobar"
    assert testnet_config.config["folders"][
        "testnet"] == "/some/where/mytestnet"
コード例 #2
0
    def __init__(self, config):
        self.config = config

        sdk_folder = workstation.get_tools_folder()

        for key, path in self.config['folders'].items():
            if key == "testnet":
                continue

            path = path.replace('{ELRONDSDK}', str(sdk_folder))

            default_tag = erdpy.config.get_dependency_tag(key)
            path = path.replace('{TAG}', default_tag)

            # If the user has not specified a custom source repository, the
            # ones provided by the SDK will be used, which are downloaded as
            # tar.gz files from GitHub. Due to how the name of the archive is
            # built by GitHub, the folder will contain the tag in two variants:
            # with the 'v' prefix (e.g. "v1.1.0"), but also without (e.g.
            # "1.1.0"), hence the need for {NOvTAG}.
            if default_tag.startswith("v"):
                default_tag = default_tag[1:]
            path = path.replace('{NOvTAG}', default_tag)

            self.config['folders'][key] = Path(path).expanduser()

        if 'testnet' not in self.config['folders']:
            self.config['folders']['testnet'] = Path().absolute() / 'testnet'

        self.__dict__.update(self.config)
コード例 #3
0
 def get_sdk_testnet_config(cls):
     default = cls.default()
     filename = workstation.get_tools_folder() / "testnet.toml"
     logger.info('sdk_testnet_config filename %s', filename)
     if not filename.exists():
         logger.info('writing sdk_testnet_config from defaults')
         utils.write_toml_file(str(filename), default)
         return default
     sdk_testnet_config = utils.read_toml_file(filename)
     return merge_configs(default, sdk_testnet_config)
コード例 #4
0
    def __init__(self):
        tools_folder = get_tools_folder()

        txs_file_dir = path.join(tools_folder, "transactions")
        # create transactions directory if not exits
        if not os.path.exists(txs_file_dir):
            os.mkdir(txs_file_dir)

        self.txs_file_path = path.join(txs_file_dir, self._TXS_FILE_NAME)
        if not os.path.exists(self.txs_file_path):
            # create transactions file if not exits
            utils.write_file(self.txs_file_path,
                             '{"' + self._TXS_FIELD_NAME + '":[]}')

        self.txs_info_file_path = path.join(txs_file_dir,
                                            self._TXS_INFO_FILE_NAME)
        if not os.path.exists(self.txs_info_file_path):
            utils.write_file(self.txs_info_file_path, f"index:{0}")
コード例 #5
0
 def get_parent_directory(self):
     tools_folder = workstation.get_tools_folder()
     return path.join(tools_folder, self.key)
コード例 #6
0
 def get_directory(self, tag: str):
     tools_folder = workstation.get_tools_folder()
     return path.join(tools_folder, "vendor-rust")
コード例 #7
0
 def _get_rustup_path(self):
     tools_folder = workstation.get_tools_folder()
     return path.join(tools_folder, "rustup.sh")
コード例 #8
0
 def _get_archive_path(self, tag: str) -> str:
     tools_folder = workstation.get_tools_folder()
     archive = path.join(tools_folder, f"{self.key}.{tag}.{self.archive_type}")
     return archive
コード例 #9
0
 def get_folder(self):
     tools_folder = workstation.get_tools_folder()
     folder = path.join(tools_folder, "templates", self.key)
     return folder
コード例 #10
0
 def _get_archive_path(self):
     tools_folder = workstation.get_tools_folder()
     archive = path.join(tools_folder, f"{self.key}.zip")
     return archive
コード例 #11
0
 def __init__(self, name):
     directory = path.join(workstation.get_tools_folder(), "OutputChannels")
     utils.ensure_folder(directory)
     filepath = path.join(directory, f"{name}.txt")
     self.file = open(filepath, "a")
コード例 #12
0
ファイル: modules.py プロジェクト: natebolam/elrond-sdk
 def _get_archive_path(self):
     tools_folder = workstation.get_tools_folder()
     archive = path.join(tools_folder, f"{self.name}.{self.tag}.tar.gz")
     return archive
コード例 #13
0
ファイル: modules.py プロジェクト: natebolam/elrond-sdk
 def get_directory(self):
     tools_folder = workstation.get_tools_folder()
     folder = path.join(tools_folder, self.name, self.tag)
     return folder
コード例 #14
0
ファイル: cli_data.py プロジェクト: stjordanis/elrond-sdk
def _get_filename(use_global: bool):
    if use_global:
        return workstation.get_tools_folder() / DATA_FILENAME
    return Path(os.getcwd()) / DATA_FILENAME