Skip to content

Commit

Permalink
SNOW-1639544: use new pypi repository name for installation
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mraba committed Sep 23, 2024
1 parent 0504365 commit c994e02
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Formula/snowcli.tmpl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def install
venv.instance_variable_get(:@formula).system venv.instance_variable_get(:@venv_root)/"bin/python",
"-m", "ensurepip", "--upgrade"
venv.instance_variable_get(:@formula).system venv.instance_variable_get(:@venv_root)/"bin/python",
"-m", "pip", "install", "snowflake-cli-labs=={{ version }}"
"-m", "pip", "install", "snowflake-cli=={{ version }}"
bin.install_symlink "#{libexec}/bin/snow" => "snow"
end

test do
false
end
end
end
4 changes: 2 additions & 2 deletions Formula/snowflake-cli.tmpl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def install
venv.instance_variable_get(:@formula).system venv.instance_variable_get(:@venv_root)/"bin/python",
"-m", "ensurepip", "--upgrade"
venv.instance_variable_get(:@formula).system venv.instance_variable_get(:@venv_root)/"bin/python",
"-m", "pip", "install", "snowflake-cli-labs=={{ version }}"
"-m", "pip", "install", "snowflake-cli=={{ version }}"
bin.install_symlink "#{libexec}/bin/snow" => "snow"
end

test do
false
end
end
end
24 changes: 15 additions & 9 deletions update-snowcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,29 @@ def main():
loader=jinja2.loaders.FileSystemLoader(Path(__file__).parent)
)
template = env.get_template("Formula/snowcli.tmpl.rb")
packages = subprocess.check_output(["poet", "snowflake-cli-labs"], encoding="utf-8")
packages = subprocess.check_output(["poet", "snowflake-cli"], encoding="utf-8")

sf_pattern = r'\s+resource \"snowflake-cli-labs\" do\s+url \"(.+)\"\s+sha256 \"(\w+)\"\s+end\n'
sf_pattern = (
r"\s+resource \"snowflake-cli\" do\s+url \"(.+)\"\s+sha256 \"(\w+)\"\s+end\n"
)
match = re.findall(sf_pattern, packages)
if not match:
raise ValueError("snowflake dependency not present in deps")
sf_url, sf_sha = match[0]

version = subprocess.check_output(["snow", "--version"], encoding="utf-8").split()[-1]
version = subprocess.check_output(["snow", "--version"], encoding="utf-8").split()[
-1
]

with open("Formula/snowcli.rb", "w+") as fh:
fh.write(template.render(
sf_url=sf_url,
sf_sha=sf_sha,
version=version,
))
fh.write(
template.render(
sf_url=sf_url,
sf_sha=sf_sha,
version=version,
)
)


if __name__ == '__main__':
if __name__ == "__main__":
main()
24 changes: 15 additions & 9 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,29 @@ def main():
loader=jinja2.loaders.FileSystemLoader(Path(__file__).parent)
)
template = env.get_template("Formula/snowflake-cli.tmpl.rb")
packages = subprocess.check_output(["poet", "snowflake-cli-labs"], encoding="utf-8")
packages = subprocess.check_output(["poet", "snowflake-cli"], encoding="utf-8")

sf_pattern = r'\s+resource \"snowflake-cli-labs\" do\s+url \"(.+)\"\s+sha256 \"(\w+)\"\s+end\n'
sf_pattern = (
r"\s+resource \"snowflake-cli\" do\s+url \"(.+)\"\s+sha256 \"(\w+)\"\s+end\n"
)
match = re.findall(sf_pattern, packages)
if not match:
raise ValueError("snowflake dependency not present in deps")
sf_url, sf_sha = match[0]

version = subprocess.check_output(["snow", "--version"], encoding="utf-8").split()[-1]
version = subprocess.check_output(["snow", "--version"], encoding="utf-8").split()[
-1
]

with open("Formula/snowflake-cli.rb", "w+") as fh:
fh.write(template.render(
sf_url=sf_url,
sf_sha=sf_sha,
version=version,
))
fh.write(
template.render(
sf_url=sf_url,
sf_sha=sf_sha,
version=version,
)
)


if __name__ == '__main__':
if __name__ == "__main__":
main()

0 comments on commit c994e02

Please sign in to comment.