Hi Andy,
You can use a pair of ``tags`` object and ``-t`` option of
sphinx-build command for that purpose.
```
# in conf.py
if tags.has('master'):
# when `-t master` given for sphinx-build
...
else:
# otherwise
...
```
Thanks,
Takeshi KOMIYA
2019年11月22日(金) 22:55 Andy Cheesman <[email protected]>:
>
> Hi everyone,
>
> I would like to pass a custom variable to the conf.py so I can apply some
> logic rules within the conf.
> (this is a simple example, I know I can do this with other option but i can
> expand this to do more beyond the scope of the question)
>
> if branch_name == "master":
> todo_include_todos = False
> else:
> todo_include_todos = True
> tags.add("internal")
>
> However, when I try to build, it fails with the error below.
> The -D option (-D branch_name=develop) results in the same issue.
>
> NameError: name 'branch_name' is not defined.
>
> If I define the variable in the conf, there is no error but it isn't
> overwritten by the -D command
>
> Anyone got any suggestions what I should do?
>
> Thanks
>
> Andy
>
> --
> You received this message because you are subscribed to the Google Groups
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sphinx-users/1ffb4ae7-073b-4632-b7d3-5ee802f62960%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sphinx-users/CAFmkQAMPAkfw%2Beb1kKJOR9mJSB6KQ_LsNRtt9ybjTX1rQ5kSQQ%40mail.gmail.com.