-
Notifications
You must be signed in to change notification settings - Fork 87
Get rid of pkg_resources #1493
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
base: stable/4.6
Are you sure you want to change the base?
Get rid of pkg_resources #1493
Changes from all commits
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 |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ | |
| # All configuration values have a default; values that are commented out | ||
| # serve to show the default. | ||
|
|
||
| import pkg_resources | ||
| import importlib.metadata | ||
|
|
||
| # -- General configuration ----------------------------------------------------- | ||
|
|
||
|
|
@@ -38,7 +38,7 @@ | |
| # built documents. | ||
| # | ||
| # The short X.Y version. | ||
| release = pkg_resources.get_distribution('gnocchi').version | ||
| release = importlib.metadata.version('gnocchi') | ||
|
Contributor
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. release = importlib_metadata.version('gnocchi') |
||
|
|
||
| # List of patterns, relative to source directory, that match files and | ||
| # directories to ignore when looking for source files. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,10 +12,10 @@ | |
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import pkg_resources | ||
| import importlib.metadata | ||
|
Contributor
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. For Python <3.10, this will need to be something like: try:
import importlib.metadata as importlib_metadata
except ImportError:
import importlib_metadata |
||
|
|
||
| try: | ||
| __version__ = pkg_resources.get_distribution(__name__).version | ||
| except pkg_resources.DistributionNotFound: | ||
| __version__ = importlib.metadata.version('gnocchi') | ||
|
Contributor
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. __version__ = importlib_metadata.version('gnocchi') |
||
| except importlib.metadata.PackageNotFoundError: | ||
| # package is not installed | ||
| pass | ||
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.
For Python <3.10, this will need to be something like: