Skip to content

Commit

Permalink
Merge pull request #73 from pulumi/pgavlin/utilities
Browse files Browse the repository at this point in the history
[python] Do not overwrite _utilities.py.
  • Loading branch information
viveklak authored Feb 7, 2022
2 parents e82e217 + f8f6e26 commit fac0c9c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ CHANGELOG
## HEAD (Unreleased)
_(none)

## 1.2.0 (2022-02-07)
- [python] Do not overwrite _utilities.py (https://github.com/pulumi/crd2pulumi/pull/73/)

---

## 1.1.0 (2022-01-04)
Expand Down
29 changes: 0 additions & 29 deletions gen/python.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ func (pg *PackageGenerator) genPythonFiles(name string) (map[string]*bytes.Buffe
delete(files, unneededFile)
}

// Replace _utilities.py with our own hard-coded version
utilitiesPath := filepath.Join(pythonPackageDir, "_utilities.py")
_, ok := files[utilitiesPath]
contract.Assertf(ok, "missing _utilities.py file")
files[utilitiesPath] = []byte(pythonUtilitiesFile)

// Import the actual SDK ObjectMeta types in place of our placeholder ones
if pg.HasSchemas() {
metaPath := filepath.Join(pythonPackageDir, "meta/v1", "__init__.py")
Expand All @@ -90,26 +84,3 @@ func (pg *PackageGenerator) genPythonFiles(name string) (map[string]*bytes.Buffe
}
return buffers, nil
}

const pythonUtilitiesFile = `from pulumi_kubernetes import _utilities
def get_env(*args):
return _utilities.get_env(*args)
def get_env_bool(*args):
return _utilities.get_env_bool(*args)
def get_env_int(*args):
return _utilities.get_env_int(*args)
def get_env_float(*args):
return _utilities.get_env_float(*args)
def get_version():
return _utilities.get_version()
`

0 comments on commit fac0c9c

Please sign in to comment.