Exemple #1
0
    def get_env(self):
        directory = self.get_directory(config.get_dependency_tag(self.key))
        parent_directory = self.get_parent_directory()

        return {
            "PATH": f"{path.join(directory, 'go/bin')}:{os.environ['PATH']}",
            "GOPATH": self.get_gopath(),
            "GOCACHE": path.join(parent_directory, "GOCACHE"),
            "GOROOT": path.join(directory, "go")
        }
Exemple #2
0
def check(args: Any):
    name: str = args.name
    tag: str = args.tag
    module = dependencies.get_module_by_key(name)
    default_tag: str = config.get_dependency_tag(module.key)
    tag_to_check = tag or default_tag
    installed = module.is_installed(tag_to_check)
    if installed:
        print(
            f"[{name} {tag_to_check}] is installed. Default version (tag) is [{default_tag}]."
        )
        return

    raise errors.DependencyMissing(name, tag_to_check)
Exemple #3
0
    def install(self, tag: str, overwrite: bool) -> None:
        # Fallback to default tag if not provided
        tag = tag or config.get_dependency_tag(self.key)

        logger.debug(f"install: key={self.key}, tag={tag}")

        if self._should_skip(tag, overwrite):
            logger.debug("Already exists. Skip install.")
            return

        self.uninstall(tag)
        self._do_install(tag)

        # Upon installation we update the default tag
        config.set_dependency_tag(self.key, tag)
        self._post_install(tag)
Exemple #4
0
def get_templates_repositories():
    timestamp = int(time.time())
    examples_rs_tag = config.get_dependency_tag('elrond_wasm_rs')
    examples_rs_tag_no_v = examples_rs_tag[1:]

    return [
        TemplatesRepository(
            key="sc-examples",
            url=
            f"https://github.com/ElrondNetwork/sc-examples/archive/master.zip?t={timestamp}",
            github="ElrondNetwork/sc-examples",
            relative_path="sc-examples-master"),
        TemplatesRepository(
            key="elrond-wasm-rs",
            url=
            f"https://github.com/ElrondNetwork/elrond-wasm-rs/archive/{examples_rs_tag}.zip?t={timestamp}",
            github="ElrondNetwork/elrond-wasm-rs",
            relative_path=f"elrond-wasm-rs-{examples_rs_tag_no_v}/examples")
    ]
Exemple #5
0
def get_module_directory(key: str) -> str:
    module = get_module_by_key(key)
    default_tag = config.get_dependency_tag(key)
    directory = module.get_directory(default_tag)
    return directory