Skip to content

Commit

Permalink
Fix requirement being used before installing (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
n0n1m authored Aug 31, 2024
1 parent a99d990 commit 27fb280
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from setuptools import setup, find_packages

from ufpy import __version__
import re

with open('README.md', 'r', encoding='utf-8') as mdf:
long_description = mdf.read()
Expand All @@ -15,6 +14,17 @@
project_name = 'ufpy'
github_url = f'https://github.com/{organization_name}/{project_name}'

def derive_version() -> str: # this function is stolen from discord.py
version = ''
with open('ufpy/__init__.py') as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('version is not set')

return version

__version__ = derive_version()

setup(
name=project_name,
Expand Down

0 comments on commit 27fb280

Please sign in to comment.