Skip to content

Commit

Permalink
Modernize the __version__ search in setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jond01 committed Jun 20, 2021
1 parent 5652be3 commit e7c4814
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import codecs
import os.path

from setuptools import setup, find_packages


def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()


def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
with open(rel_path, 'r') as fp:
for line in fp:
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")


with open('README.md') as f:
Expand Down

0 comments on commit e7c4814

Please sign in to comment.