12/5/2011 1:47 PM, Alastair Dent ?????:
Thanks, that helps. I really don't know anything about Python - my background 
is with languages like Fortran and Pascal.

How do I pass an argument to conf.py?

If I were doing this in Pascal I'd declare it as a global variable and 
initialise it explicitly at an appropriate point. Python doesn't seem to work 
like that.  From what I can tell, I need to use something like:

ifconf_product = sys.argv[1]

in the conf.py. But how do I call conf.py with an argument?

-----Original Message-----
From: sphinx-dev@googlegroups.com [mailto:sphinx-dev@googlegroups.com] On 
Behalf Of Ernesto Posse
Sent: 02 December 2011 22:29
To: sphinx-dev@googlegroups.com
Subject: Re: [sphinx-dev] Using if statements in conf.py

On Fri, Dec 2, 2011 at 11:27 AM, Alastair Dent<alastair.d...@imgtec.com>  wrote:
Can I do something like the following in conf.py:
You can but you'll have to use Python syntax (conf.py is a Python module), so 
instead of

if ifconf_product='mini' then

exclude_patterns = ['interface/*.rst','dialogs/*.rst']

elseif ifconf_product='main' then

                 exclude_patterns = ['mini-indexes.rst]



endif
it should be something like

if ifconf_product=='mini':
     exclude_patterns = ['interface/*.rst','dialogs/*.rst']
elif ifconf_product=='main':
     exclude_patterns = ['mini-indexes.rst]


--
Ernesto Posse

Modelling and Analysis in Software Engineering School of Computing Queen's 
University - Kingston, Ontario, Canada

--
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.


Hello!

There are different ways to do that:
    1. Use os.system("python conf.py param1 param2");
    2. Use subprocess python module:
importsubprocess
child = subprocess.Popen("python conf.py param1 param2").


--
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to