Skip to content

Commit

Permalink
release version file functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilkka-LBL committed Oct 28, 2024
1 parent 257a5b4 commit 516e03e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
9 changes: 7 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
# Add the parent directory to sys.path to allow imports
sys.path.insert(0, os.path.abspath('../../'))

with open('./release.txt') as f:
version = f.read()
from pathlib import Path

# Get the path to the release.txt file
release_file = Path(__file__).resolve().parent.parent / 'release.txt'

with open(release_file) as f:
version = f.read().strip()

project = 'Consensus'
copyright = '2024, Ilkka Sipila - Lewisham Council Data Science and Insight team'
Expand Down
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
import shutil
import os
from setuptools import setup, find_packages, Command
from pathlib import Path

with open('README.md') as f:
long_description = f.read()

with open('release.txt') as f:
version = f.read()

def read_release_version():
# Get the path to the release.txt file
return (Path(__file__).parent / 'release.txt').read_text().strip()


class CleanCommand(Command):
Expand Down Expand Up @@ -48,10 +51,10 @@ def package_files(directory):

setup(
name='Consensus',
version=version,
version=read_release_version(),
author='Ilkka Sipila',
author_email='ilkka.sipila@lewisham.gov.uk',
website='https://ilkka-lbl.github.io/Consensus/',
url='https://ilkka-lbl.github.io/Consensus/',
packages=find_packages(),
include_package_data=True,
package_data={
Expand Down

0 comments on commit 516e03e

Please sign in to comment.