1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
Description: replace obsolete file() constructor with a context manager.
Replace file(), specific to python2, with a context manager that
also closes the file after use.
Author: Nicolas Boulenguez <nicolas@debian.org>
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -48,7 +48,8 @@
def get_version():
"""Extract the version from configure.in"""
- return file("../version_information").read().strip()
+ with open ("../version_information") as f:
+ return f.readline().strip()
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
|