Ability to require minimum Python version (#8296)
Co-authored-by: Komal <komalsali@gmail.com> Co-authored-by: Justin Van Patten <jvp@justinvp.com>
This commit is contained in:
parent
1c0a7e4907
commit
df61004e3f
|
@ -1909,7 +1909,7 @@ func genPulumiPluginFile(pkg *schema.Package) ([]byte, error) {
|
|||
|
||||
// genPackageMetadata generates all the non-code metadata required by a Pulumi package.
|
||||
func genPackageMetadata(
|
||||
tool string, pkg *schema.Package, pyPkgName string, emitPulumiPluginFile bool, requires map[string]string) (string, error) {
|
||||
tool string, pkg *schema.Package, pyPkgName string, emitPulumiPluginFile bool, requires map[string]string, pythonRequires string) (string, error) {
|
||||
|
||||
w := &bytes.Buffer{}
|
||||
(&modContext{tool: tool}).genHeader(w, false /*needsSDK*/, nil)
|
||||
|
@ -1960,6 +1960,9 @@ func genPackageMetadata(
|
|||
|
||||
// Finally, the actual setup part.
|
||||
fmt.Fprintf(w, "setup(name='%s',\n", pyPkgName)
|
||||
if pythonRequires != "" {
|
||||
fmt.Fprintf(w, " python_requires='%s',\n", pythonRequires)
|
||||
}
|
||||
fmt.Fprintf(w, " version=VERSION,\n")
|
||||
if pkg.Description != "" {
|
||||
fmt.Fprintf(w, " description=%q,\n", sanitizePackageDescription(pkg.Description))
|
||||
|
@ -2783,7 +2786,7 @@ func GeneratePackage(tool string, pkg *schema.Package, extraFiles map[string][]b
|
|||
}
|
||||
|
||||
// Finally emit the package metadata (setup.py).
|
||||
setup, err := genPackageMetadata(tool, pkg, pkgName, info.EmitPulumiPluginFile, info.Requires)
|
||||
setup, err := genPackageMetadata(tool, pkg, pkgName, info.EmitPulumiPluginFile, info.Requires, info.PythonRequires)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -34,8 +34,10 @@ type PropertyInfo struct {
|
|||
// PackageInfo tracks Python-specific information associated with a package.
|
||||
type PackageInfo struct {
|
||||
// PackageName is an override for the name of the generated python package.
|
||||
PackageName string `json:"packageName,omitempty"`
|
||||
Requires map[string]string `json:"requires,omitempty"`
|
||||
PackageName string `json:"packageName,omitempty"`
|
||||
// PythonRequires determines the Python versions that the generated provider supports
|
||||
PythonRequires string `json:"pythonRequires,omitempty"`
|
||||
Requires map[string]string `json:"requires,omitempty"`
|
||||
// Readme contains the text for the package's README.md files.
|
||||
Readme string `json:"readme,omitempty"`
|
||||
// Optional overrides for Pulumi module names
|
||||
|
|
Loading…
Reference in a new issue