Skip to content

Commit

Permalink
Move CSS file to mlx/assets; address deprecation warnings of pkg_reso…
Browse files Browse the repository at this point in the history
…urces
  • Loading branch information
JasperCraeghs committed Jan 12, 2024
1 parent 1e5dbc5 commit b4f5e28
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
29 changes: 16 additions & 13 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import os
import mlx.traceability
from pkg_resources import get_distribution
from importlib.metadata import distribution
from pathlib import Path

import mlx.traceability
import mlx.xunit2rst
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand All @@ -21,16 +23,16 @@
authors = ['Bavo Van Achte', 'Jasper Craeghs']

# The full version, including alpha/beta/rc tags
release = get_distribution('mlx.xunit2rst').version
release = distribution('mlx.xunit2rst').version
version = '.'.join(release.split('.')[:2])

latex_documents = [
('index', 'xunit2rst.tex', 'Script to convert .robot files to .rst files with traceable items',
('index', 'xunit2rst.tex', 'Script to convert xUnit files to .rst files with traceable items',
' \\and '.join(authors), 'manual', True),
]

man_pages = [
('index', 'xunit2rst', 'Script to convert .robot files to .rst files with traceable items',
('index', 'xunit2rst', 'Script to convert xUnit files to .rst files with traceable items',
authors, 1)
]

Expand All @@ -41,7 +43,7 @@
# dir menu entry, description, category)
texinfo_documents = [
('index', 'xunit2rst', 'xunit2rst conversion script', '@*'.join(authors), 'xunit2rst',
'Script to convert .robot files to .rst files with traceable items.', 'Miscellaneous'),
'Script to convert xUnit files to .rst files with traceable items.', 'Miscellaneous'),
]

# -- General configuration ---------------------------------------------------
Expand Down Expand Up @@ -114,17 +116,18 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = [os.path.join(os.path.dirname(mlx.traceability.__file__), 'assets'),
'_static']

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
'xunit2rst.css',
html_static_path = [
str(Path(mlx.traceability.__file__).parent / 'assets'),
str(Path(mlx.xunit2rst.__file__).parent / 'assets'),
]

traceability_render_relationship_per_item = True


def setup(app):
# Color Test Results
app.add_css_file('xunit2rst.css')

# To demo --only input argument
if os.environ.get('LAYER', 'FLASH') == 'FLASH':
tags.add('FLASH')
6 changes: 3 additions & 3 deletions mlx/xunit2rst/xunit2rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import logging
import xml.etree.ElementTree as ET
from collections import namedtuple
from importlib.metadata import distribution, PackageNotFoundError
from pathlib import Path
from textwrap import indent

from mako.exceptions import RichTraceback
from mako.template import Template
from pkg_resources import DistributionNotFound, require
from ruamel.yaml import YAML

TraceableInfo = namedtuple("TraceableInfo", ['matrix_prefix', 'type', 'header_prefix'])
Expand Down Expand Up @@ -229,8 +229,8 @@ def verify_prefix_set(prefix_set, prefix, type_):
def create_parser():
""" Creates and returns the ArgumentParser instance to be used """
try:
version = require('mlx.xunit2rst')[0].version
except DistributionNotFound:
version = distribution('mlx.xunitrst').version
except PackageNotFoundError:
version = '0.0.0.dev'
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('-i', '--input',
Expand Down

0 comments on commit b4f5e28

Please sign in to comment.