Merge lp:~cjwatson/lazr.restfulclient/faster-version into lp:lazr.restfulclient

Proposed by Colin Watson
Status: Merged
Merged at revision: 175
Proposed branch: lp:~cjwatson/lazr.restfulclient/faster-version
Merge into: lp:lazr.restfulclient
Diff against target: 93 lines (+13/-13)
4 files modified
NEWS.rst (+2/-0)
setup.py (+2/-4)
src/lazr/restfulclient/__init__.py (+6/-5)
src/lazr/restfulclient/docs/conf.py (+3/-4)
To merge this branch: bzr merge lp:~cjwatson/lazr.restfulclient/faster-version
Reviewer Review Type Date Requested Status
Cristian Gonzalez (community) Approve
Review via email: mp+408470@code.launchpad.net

Commit message

Adjust versioning strategy to avoid importing pkg_resources, which is slow in large environments.

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS.rst'
--- NEWS.rst 2021-01-18 23:11:05 +0000
+++ NEWS.rst 2021-09-13 09:39:14 +0000
@@ -6,6 +6,8 @@
6======6======
77
8 - Drop support for Python < 2.6.8 - Drop support for Python < 2.6.
9 - Adjust versioning strategy to avoid importing pkg_resources, which is
10 slow in large environments.
911
100.14.3 (2020-01-27)120.14.3 (2020-01-27)
11===================13===================
1214
=== modified file 'setup.py'
--- setup.py 2019-11-04 12:35:42 +0000
+++ setup.py 2021-09-13 09:39:14 +0000
@@ -36,8 +36,6 @@
36# end generic helpers36# end generic helpers
3737
3838
39__version__ = open("src/lazr/restfulclient/version.txt").read().strip()
40
41tests_require = [39tests_require = [
42 'fixtures>=1.3.0',40 'fixtures>=1.3.0',
43 'lazr.authentication',41 'lazr.authentication',
@@ -51,11 +49,10 @@
5149
52setup(50setup(
53 name='lazr.restfulclient',51 name='lazr.restfulclient',
54 version=__version__,52 version='0.14.4',
55 namespace_packages=['lazr'],53 namespace_packages=['lazr'],
56 packages=find_packages('src'),54 packages=find_packages('src'),
57 package_dir={'':'src'},55 package_dir={'':'src'},
58 package_data={'lazr.restfulclient': ['version.txt']},
59 include_package_data=True,56 include_package_data=True,
60 zip_safe=False,57 zip_safe=False,
61 maintainer='LAZR Developers',58 maintainer='LAZR Developers',
@@ -69,6 +66,7 @@
69 'distro',66 'distro',
70 'httplib2; python_version < "3"',67 'httplib2; python_version < "3"',
71 'httplib2>=0.7.7; python_version >= "3"',68 'httplib2>=0.7.7; python_version >= "3"',
69 'importlib-metadata; python_version < "3.8"',
72 'oauthlib',70 'oauthlib',
73 'setuptools',71 'setuptools',
74 'six',72 'six',
7573
=== modified file 'src/lazr/restfulclient/__init__.py'
--- src/lazr/restfulclient/__init__.py 2018-04-27 13:37:34 +0000
+++ src/lazr/restfulclient/__init__.py 2021-09-13 09:39:14 +0000
@@ -16,8 +16,9 @@
16# License along with lazr.restfulclient. If not, see16# License along with lazr.restfulclient. If not, see
17# <http://www.gnu.org/licenses/>.17# <http://www.gnu.org/licenses/>.
1818
19import pkg_resources19try:
20__version__ = pkg_resources.resource_string(20 import importlib.metadata as importlib_metadata
21 "lazr.restfulclient", "version.txt").strip()21except ImportError:
22if not isinstance(__version__, str):22 import importlib_metadata
23 __version__ = __version__.decode('ASCII')23
24__version__ = importlib_metadata.version("lazr.restfulclient")
2425
=== modified file 'src/lazr/restfulclient/docs/conf.py'
--- src/lazr/restfulclient/docs/conf.py 2018-05-08 08:05:00 +0000
+++ src/lazr/restfulclient/docs/conf.py 2021-09-13 09:39:14 +0000
@@ -12,8 +12,7 @@
12# All configuration values have a default; values that are commented out12# All configuration values have a default; values that are commented out
13# serve to show the default.13# serve to show the default.
1414
15with open('../version.txt') as version_file:15from lazr.restfulclient import __version__
16 _version = version_file.read().strip()
1716
18# If extensions (or modules to document with autodoc) are in another directory,17# If extensions (or modules to document with autodoc) are in another directory,
19# add these directories to sys.path here. If the directory is relative to the18# add these directories to sys.path here. If the directory is relative to the
@@ -56,9 +55,9 @@
56# built documents.55# built documents.
57#56#
58# The short X.Y version.57# The short X.Y version.
59version = _version58version = __version__
60# The full version, including alpha/beta/rc tags.59# The full version, including alpha/beta/rc tags.
61release = _version60release = __version__
6261
63# The language for content autogenerated by Sphinx. Refer to documentation62# The language for content autogenerated by Sphinx. Refer to documentation
64# for a list of supported languages.63# for a list of supported languages.
6564
=== removed file 'src/lazr/restfulclient/version.txt'

Subscribers

People subscribed via source and target branches