Completed
Push — master ( 9b184b...8554f5 )
by Paolo
19s queued 13s
created

conf.skip()   A

Complexity

Conditions 2

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
nop 6
1
# Configuration file for the Sphinx documentation builder.
2
#
3
# This file only contains a selection of the most common options. For a full
4
# list see the documentation:
5
# http://www.sphinx-doc.org/en/master/config
6
7
# -- Path setup --------------------------------------------------------------
8
9
# If extensions (or modules to document with autodoc) are in another directory,
10
# add these directories to sys.path here. If the directory is relative to the
11
# documentation root, use os.path.abspath to make it absolute, like shown here.
12
#
13
import os
14
import sys
15
import django
16
import subprocess
17
18
git_lfs_version = "v2.9.0"
19
20
project_path = os.path.dirname(
21
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
22
sys.path.insert(0, project_path)
23
os.environ['DJANGO_SETTINGS_MODULE'] = 'image.settings'
24
django.setup()
25
26
# Workaround modified to install and execute git-lfs on Read the Docs
27
# https://github.com/readthedocs/readthedocs.org/issues/1846#issuecomment-477184259
28
injecttool_dir = subprocess.getoutput('git rev-parse --show-toplevel')
29
30
# I want to install git-lfs here
31
bin_dir = os.path.join(injecttool_dir, "bin")
32
33
if not os.path.exists(bin_dir):
34
    os.mkdir(bin_dir)
35
36
# add a new path to PATH environment variable
37
os.environ['PATH'] += ":%s" % (bin_dir)
38
39
# this will be the directory where git lfs will be installed
40
git_lfs_path = '%s/.git/lfs' % (injecttool_dir)
41
42
if not os.path.exists(git_lfs_path):
43
    os.system(
44
        'wget -P {dest}/ https://github.com/git-lfs/git-lfs'
45
        '/releases/download/'
46
        '{version}/git-lfs-linux-amd64-{version}.tar.gz'.format(
47
            version=git_lfs_version,
48
            dest=bin_dir))
49
50
    os.system(
51
            'tar xvfz {path}/git-lfs-linux-amd64-{version}.tar.gz'
52
            ' -C {path}'.format(
53
                version=git_lfs_version,
54
                path=bin_dir))
55
56
    # test the system
57
    os.system('git-lfs ls-files')
58
59
    # make lfs available in current repository
60
    os.system('git-lfs install')
61
62
else:
63
    print("Git lfs already configured. Skipping")
64
65
if os.path.exists(os.path.join(bin_dir, "git-lfs")):
66
    # download content from remote
67
    os.system('git-lfs fetch')
68
69
    # make local files to have the real content on them
70
    os.system('git-lfs checkout')
71
72
73
# -- Project information -----------------------------------------------------
74
75
project = 'IMAGE-InjectTool'
76
copyright = '2019, Paolo Cozzi'
77
author = 'Paolo Cozzi'
78
79
# The full version, including alpha/beta/rc tags
80
release = 'v0.9.5'
81
82
83
# -- General configuration ---------------------------------------------------
84
85
# Add any Sphinx extension module names here, as strings. They can be
86
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
87
# ones.
88
extensions = [
89
    'sphinx.ext.autodoc',
90
    'sphinx.ext.autosectionlabel',
91
    'sphinx.ext.viewcode',
92
    'sphinx.ext.intersphinx',
93
    'sphinx.ext.napoleon',
94
    'celery.contrib.sphinx'
95
]
96
97
# Add any paths that contain templates here, relative to this directory.
98
templates_path = ['_templates']
99
100
# The suffix(es) of source filenames.
101
# You can specify multiple suffix as a list of string:
102
source_suffix = ['.rst', '.md']
103
104
# The master toctree document.
105
master_doc = 'index'
106
107
# List of patterns, relative to source directory, that match files and
108
# directories to ignore when looking for source files.
109
# This pattern also affects html_static_path and html_extra_path.
110
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
111
112
# The name of the Pygments (syntax highlighting) style to use.
113
pygments_style = 'sphinx'
114
115
# If true, `todo` and `todoList` produce output, else they produce nothing.
116
todo_include_todos = False
117
118
119
# document __init__ class method
120
# https://stackoverflow.com/questions/5599254/how-to-use-sphinxs-autodoc-to-document-a-classs-init-self-method
121
def skip(app, what, name, obj, skip, options):
122
    if name == "__init__":
123
        return False
124
    return skip
125
126
127
def setup(app):
128
    app.connect("autodoc-skip-member", skip)
129
130
131
# Link to other projects’ documentation
132
intersphinx_mapping = {
133
    'python': ('https://docs.python.org/3.6', None),
134
    'django': (
135
        'http://docs.djangoproject.com/en/dev/',
136
        'https://docs.djangoproject.com/en/dev/_objects/'),
137
    'celery': ('http://celery.readthedocs.org/en/latest/', None),
138
    'pyUSIrest': ('https://pyusirest.readthedocs.io/en/latest/', None),
139
    }
140
141
142
# -- Options for HTML output -------------------------------------------------
143
144
# The theme to use for HTML and HTML Help pages.  See the documentation for
145
# a list of builtin themes.
146
#
147
html_theme = 'nature'
148
149
# Add any paths that contain custom static files (such as style sheets) here,
150
# relative to this directory. They are copied after the builtin static files,
151
# so a file named "default.css" will overwrite the builtin "default.css".
152
html_static_path = ['_static']
153