Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
try readthedocs conf update
Browse files Browse the repository at this point in the history
  • Loading branch information
Finn Rodenberg committed Aug 19, 2020
1 parent c5a9117 commit 9fecc7e
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,33 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.


author = 'CFEL Controlled Molecule Imaging group'
copyright = '2018–2020 CFEL Controlled Molecule Imaging group <[email protected]>'
name = 'pymepix'
project = name
version = '1.1.dev0'
release = version

import os
import sys
import pathlib

# accessing the setup.py file to get current information about the project
name, project, version, release, author, copyright = [None] * 6
desired = ['copyright', 'project', 'name', 'version', 'release', 'author']

# importlib.util.spec_from_file_location didn't work as I hoped it would
# first get the path of the setup.py file
current_path = pathlib.Path(__file__).parent.absolute()
setup_path = current_path.parent.joinpath("setup.py")

# access setup.py as text file to find the necessary lines, then execute those
with open(setup_path, 'r') as f:
for i, line in enumerate(f):
line = line.strip()
line_list = line.split()
if len(line_list) > 0 and line_list[0] in desired:
exec(line)
desired.remove(line_list[0])

sys.path.insert(0, os.path.abspath('../../lib/'))
print(sys.path)

# -- General configuration ------------------------------------------------

author = 'CFEL Controlled Molecule Imaging group'

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
Expand Down

0 comments on commit 9fecc7e

Please sign in to comment.