New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move InstallDependencies to the language plugin #9294
Changes from 9 commits
06892f8
c7cd867
d98f8b7
4de3e1a
b25f999
9e6e620
45cc65e
00e51a3
6fa09ff
ec18569
74e477b
e54302c
dfbdb8c
bf29a3c
75ad940
86aa170
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ import ( | |
"github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil" | ||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" | ||
"github.com/pulumi/pulumi/sdk/v3/go/common/workspace" | ||
"github.com/pulumi/pulumi/sdk/v3/nodejs/npm" | ||
"github.com/pulumi/pulumi/sdk/v3/python" | ||
"github.com/spf13/cobra" | ||
survey "gopkg.in/AlecAivazis/survey.v1" | ||
|
@@ -189,9 +190,16 @@ func runNewPolicyPack(args newPolicyArgs) error { | |
func installPolicyPackDependencies(proj *workspace.PolicyPackProject, projPath, root string) error { | ||
// TODO[pulumi/pulumi#1334]: move to the language plugins so we don't have to hard code here. | ||
if strings.EqualFold(proj.Runtime.Name(), "nodejs") { | ||
if bin, err := nodeInstallDependencies(); err != nil { | ||
fmt.Println("Installing dependencies...") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we need to use logging instead of fmt.Println? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this is copied from nodeInstallDependencies which already used fmt.Println There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's moving processes though right. The plugin executable runs in a process where stdout is used to communicate the port on which the engine is running. Printing after that might work. I'm just careful. Hopefully the tests cover us here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope this hasn't moved process There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah never mind. Perfect ty. pkg/cmd you're right. |
||
fmt.Println() | ||
|
||
bin, err := npm.Install("", false /*production*/, os.Stdout, os.Stderr) | ||
if err != nil { | ||
return fmt.Errorf("`%s install` failed; rerun manually to try again.: %w", bin, err) | ||
} | ||
|
||
fmt.Println("Finished installing dependencies") | ||
fmt.Println() | ||
} else if strings.EqualFold(proj.Runtime.Name(), "python") { | ||
const venvDir = "venv" | ||
if err := python.InstallDependencies(root, venvDir, true /*showOutput*/); err != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Hack/Workaround/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this actually will break some users, like Nix users. There are situations where users explicitly don't want to use a venv. If Python now always uses venv even when not called for, we should highlight this as a change in CHANGELOG.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah cool I was going to ask if we could just assume "venv" but that's a good reason not to. At any rate this isn't a breaking change because we already always set venv in "pulumi new"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IN that case it's completely fine ofc.