-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06699c7
commit 026cfd2
Showing
8 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class SnowflakeCli < Formula | ||
include Language::Python::Virtualenv | ||
desc "A CLI for Snowflake development" | ||
homepage "https://github.com/snowflake-labs/snowflake-cli" | ||
url "https://files.pythonhosted.org/packages/03/69/b508427075311424de383944ecdd484918516e67081bda932779ef5360e5/snowflake_cli_labs-2.0.0.tar.gz" | ||
sha256 "28ba342cf7b55a4d7aebb97bc1da4cd3ba7b05cd247dee11f52f80a1234ffdda" | ||
|
||
depends_on "python3" | ||
|
||
def install | ||
ENV["CARGO_NET_GIT_FETCH_WITH_CLI"] = "true" | ||
#without_pip=false because of https://github.com/Homebrew/brew/pull/15792 | ||
venv = virtualenv_create(libexec, "python3", system_site_packages: false, without_pip: false) | ||
venv.instance_variable_get(:@formula).system venv.instance_variable_get(:@venv_root)/"bin/python", | ||
"-m", "pip", "install", "pip==22.3.1" | ||
venv.instance_variable_get(:@formula).system venv.instance_variable_get(:@venv_root)/"bin/pip", | ||
"install", "snowflake-cli-labs==2.0.0" | ||
bin.install_symlink "#{libexec}/bin/snow" => "snow" | ||
end | ||
|
||
test do | ||
false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class SnowflakeCli < Formula | ||
include Language::Python::Virtualenv | ||
desc "A CLI for Snowflake development" | ||
homepage "https://github.com/snowflake-labs/snowflake-cli" | ||
url "{{ sf_url }}" | ||
sha256 "{{ sf_sha }}" | ||
|
||
depends_on "python3" | ||
|
||
def install | ||
ENV["CARGO_NET_GIT_FETCH_WITH_CLI"] = "true" | ||
#without_pip=false because of https://github.com/Homebrew/brew/pull/15792 | ||
venv = virtualenv_create(libexec, "python3", system_site_packages: false, without_pip: false) | ||
venv.instance_variable_get(:@formula).system venv.instance_variable_get(:@venv_root)/"bin/python", | ||
"-m", "pip", "install", "pip==22.3.1" | ||
venv.instance_variable_get(:@formula).system venv.instance_variable_get(:@venv_root)/"bin/pip", | ||
"install", "snowflake-cli-labs=={{ version }}" | ||
bin.install_symlink "#{libexec}/bin/snow" => "snow" | ||
end | ||
|
||
test do | ||
false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import re | ||
import subprocess | ||
from pathlib import Path | ||
from textwrap import indent | ||
|
||
import jinja2 | ||
|
||
|
||
def main(): | ||
env = jinja2.Environment( | ||
loader=jinja2.loaders.FileSystemLoader(Path(__file__).parent) | ||
) | ||
template = env.get_template("Formula/snowflake.tmpl.rb") | ||
packages = subprocess.check_output(["poet", "snowflake-cli-labs"], encoding="utf-8") | ||
|
||
sf_pattern = r'\s+resource \"snowflake-cli-labs\" 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] | ||
|
||
with open("Formula/snowcli.rb", "w+") as fh: | ||
fh.write(template.render( | ||
sf_url=sf_url, | ||
sf_sha=sf_sha, | ||
version=version, | ||
)) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters