Skip to content

Commit

Permalink
rewrite logic to get version from direct file read
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdsharpe committed Oct 5, 2023
1 parent 098763e commit 9c8081d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
from pathlib import Path
import importlib

# Get the long description from the README file
README_path = Path(__file__).parent / "README.md"
with open(README_path, encoding='utf-8') as f:
long_description = f.read()

### Get the version number dynamically
version = importlib.import_module(
"aerosandbox.__init__",
package="aerosandbox"
).__version__
init_path = Path(__file__).parent / "aerosandbox" / "__init__.py"

with open(init_path) as f:
for line in f:
if line.startswith("__version__"):
version = line.split("=")[1].strip().strip('"').strip("'")
break
else:
raise RuntimeError("Unable to find version string.")

### Do the setup
setup(
Expand Down

0 comments on commit 9c8081d

Please sign in to comment.