diff --git a/setup.py b/setup.py index 6753680..e8d1279 100644 --- a/setup.py +++ b/setup.py @@ -17,20 +17,19 @@ class eo_sdist(sdist): if os.path.exists('VERSION'): os.remove('VERSION') version = get_version() - version_file = open('VERSION', 'w') - version_file.write(version) - version_file.close() + with open('VERSION', 'w') as fd: + fd.write(version) sdist.run(self) if os.path.exists('VERSION'): os.remove('VERSION') def get_version(): - '''Use the VERSION, if absent generates a version with git describe, if not + """Use the VERSION, if absent generates a version with git describe, if not tag exists, take 0.0- and add the length of the commit log. - ''' + """ if os.path.exists('VERSION'): - with open('VERSION', 'r') as v: + with open('VERSION') as v: return v.read() if os.path.exists('.git'): p = subprocess.Popen(