Skip to content

Commit

Permalink
Add version information
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Feb 16, 2024
1 parent dcc7e91 commit 3f18d7f
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import subprocess, os
import re
from datetime import datetime

def configureDoxyfile(src_dir, input_dir, output_dir, doxyfile_in, doxyfile_out):

Expand All @@ -26,12 +28,32 @@ def configureDoxyfile(src_dir, input_dir, output_dir, doxyfile_in, doxyfile_out)

with open(doxyfile_out, 'w') as file:
file.write(filedata)

def get_version(src_dir):
cmake_file = src_dir + 'CMakeLists.txt'

# -- Project information -----------------------------------------------------
with open(cmake_file, 'r') as f:
txt = f.read()

version = '0.0.0'
try:
regex = 'project\((\n|.)*?\)'
project_detail = re.search(regex, txt).group()
version_detail = re.search('VERSION.*', project_detail).group()
version = re.split("\s", version_detail)[-1]
except:
print(f'version not found in {cmake_file}. Use {version} as default.')

project = 'KokkosFFT'
copyright = '2023, Yuuichi Asahi'
return version

# -- Project information -----------------------------------------------------
author = 'Yuuichi Asahi'
project = 'KokkosFFT'
copyright = f"2023-{datetime.now().year}, {author}"

version = get_version('../')

release = 'release'

# Check if we're running on Read the Docs' servers
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
Expand Down

0 comments on commit 3f18d7f

Please sign in to comment.