public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] doc: Use a separate directory for new modules we add to PATH
@ 2022-11-09 21:31 Arsen Arsenović
  2022-11-09 22:18 ` David Malcolm
  2022-11-10  5:26 ` Martin Liška
  0 siblings, 2 replies; 3+ messages in thread
From: Arsen Arsenović @ 2022-11-09 21:31 UTC (permalink / raw)
  To: gcc-patches; +Cc: Arsen Arsenović, Martin Liška

ChangeLog:

	* doc/baseconf.py: Inject dirname(__file__)/'modules' to path
	instead of just ``.''.
	* doc/gcc_sphinx.py: Moved to...
	* doc/modules/gcc_sphinx.py: ...here.
---
Evening,

This patch addresses a path mixup and provides a nice compromise between
convenience for the user and namespace cleanliness.  Further modules
that Sphinx imports internally from the GCC tree should also go into
this directory.  I moved gcc_sphinx since I knew of that one, but there
could be others I'm missing.

Tested on x86_64-pc-linux-gnu with ``make html''.

Have a great night!

 doc/baseconf.py                 | 4 +++-
 doc/{ => modules}/gcc_sphinx.py | 0
 2 files changed, 3 insertions(+), 1 deletion(-)
 rename doc/{ => modules}/gcc_sphinx.py (100%)

diff --git a/doc/baseconf.py b/doc/baseconf.py
index 47e3a126416..d85659e4540 100644
--- a/doc/baseconf.py
+++ b/doc/baseconf.py
@@ -13,7 +13,6 @@
 import os
 import time
 import sys
-# sys.path.insert(0, os.path.abspath('.'))
 
 # gccint needs a deeper stack limit
 sys.setrecursionlimit(2000)
@@ -23,8 +22,11 @@ sys.setrecursionlimit(2000)
 # The full version, including alpha/beta/rc tags
 
 folder = os.path.dirname(os.path.realpath(__file__))
+doc_modules = os.path.join(folder, 'modules')
 gcc_srcdir = os.path.join(folder, '..', 'gcc')
 
+sys.path.insert(0, doc_modules)
+
 def read_file(name):
     path = os.path.join(gcc_srcdir, name)
     if os.path.exists(path):
diff --git a/doc/gcc_sphinx.py b/doc/modules/gcc_sphinx.py
similarity index 100%
rename from doc/gcc_sphinx.py
rename to doc/modules/gcc_sphinx.py
-- 
2.38.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] doc: Use a separate directory for new modules we add to PATH
  2022-11-09 21:31 [PATCH] doc: Use a separate directory for new modules we add to PATH Arsen Arsenović
@ 2022-11-09 22:18 ` David Malcolm
  2022-11-10  5:26 ` Martin Liška
  1 sibling, 0 replies; 3+ messages in thread
From: David Malcolm @ 2022-11-09 22:18 UTC (permalink / raw)
  To: Arsen Arsenović, gcc-patches; +Cc: Martin Liška

On Wed, 2022-11-09 at 22:31 +0100, Arsen Arsenović via Gcc-patches
wrote:
> ChangeLog:
> 
>         * doc/baseconf.py: Inject dirname(__file__)/'modules' to path
>         instead of just ``.''.
>         * doc/gcc_sphinx.py: Moved to...
>         * doc/modules/gcc_sphinx.py: ...here.
> ---
> Evening,
> 
> This patch addresses a path mixup 

FWIW this patch fixes the build of the docs for me; without it I run
into the "Could not import extension gcc_sphinx (exception: No module
named 'gcc_sphinx')" issue we were discussing on IRC.

Thanks!
Dave

> and provides a nice compromise between
> convenience for the user and namespace cleanliness.  Further modules
> that Sphinx imports internally from the GCC tree should also go into
> this directory.  I moved gcc_sphinx since I knew of that one, but
> there
> could be others I'm missing.
> 
> Tested on x86_64-pc-linux-gnu with ``make html''.
> 
> Have a great night!
> 
>  doc/baseconf.py                 | 4 +++-
>  doc/{ => modules}/gcc_sphinx.py | 0
>  2 files changed, 3 insertions(+), 1 deletion(-)
>  rename doc/{ => modules}/gcc_sphinx.py (100%)
> 
> diff --git a/doc/baseconf.py b/doc/baseconf.py
> index 47e3a126416..d85659e4540 100644
> --- a/doc/baseconf.py
> +++ b/doc/baseconf.py
> @@ -13,7 +13,6 @@
>  import os
>  import time
>  import sys
> -# sys.path.insert(0, os.path.abspath('.'))
>  
>  # gccint needs a deeper stack limit
>  sys.setrecursionlimit(2000)
> @@ -23,8 +22,11 @@ sys.setrecursionlimit(2000)
>  # The full version, including alpha/beta/rc tags
>  
>  folder = os.path.dirname(os.path.realpath(__file__))
> +doc_modules = os.path.join(folder, 'modules')
>  gcc_srcdir = os.path.join(folder, '..', 'gcc')
>  
> +sys.path.insert(0, doc_modules)
> +
>  def read_file(name):
>      path = os.path.join(gcc_srcdir, name)
>      if os.path.exists(path):
> diff --git a/doc/gcc_sphinx.py b/doc/modules/gcc_sphinx.py
> similarity index 100%
> rename from doc/gcc_sphinx.py
> rename to doc/modules/gcc_sphinx.py


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] doc: Use a separate directory for new modules we add to PATH
  2022-11-09 21:31 [PATCH] doc: Use a separate directory for new modules we add to PATH Arsen Arsenović
  2022-11-09 22:18 ` David Malcolm
@ 2022-11-10  5:26 ` Martin Liška
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Liška @ 2022-11-10  5:26 UTC (permalink / raw)
  To: Arsen Arsenović, gcc-patches

On 11/9/22 22:31, Arsen Arsenović wrote:
> ChangeLog:
> 
> 	* doc/baseconf.py: Inject dirname(__file__)/'modules' to path
> 	instead of just ``.''.
> 	* doc/gcc_sphinx.py: Moved to...
> 	* doc/modules/gcc_sphinx.py: ...here.
> ---
> Evening,
> 
> This patch addresses a path mixup and provides a nice compromise between
> convenience for the user and namespace cleanliness.  Further modules
> that Sphinx imports internally from the GCC tree should also go into
> this directory.  I moved gcc_sphinx since I knew of that one, but there
> could be others I'm missing.

Thank for the patch, I'm going to push it.

Martin

> 
> Tested on x86_64-pc-linux-gnu with ``make html''.
> 
> Have a great night!
> 
>  doc/baseconf.py                 | 4 +++-
>  doc/{ => modules}/gcc_sphinx.py | 0
>  2 files changed, 3 insertions(+), 1 deletion(-)
>  rename doc/{ => modules}/gcc_sphinx.py (100%)
> 
> diff --git a/doc/baseconf.py b/doc/baseconf.py
> index 47e3a126416..d85659e4540 100644
> --- a/doc/baseconf.py
> +++ b/doc/baseconf.py
> @@ -13,7 +13,6 @@
>  import os
>  import time
>  import sys
> -# sys.path.insert(0, os.path.abspath('.'))
>  
>  # gccint needs a deeper stack limit
>  sys.setrecursionlimit(2000)
> @@ -23,8 +22,11 @@ sys.setrecursionlimit(2000)
>  # The full version, including alpha/beta/rc tags
>  
>  folder = os.path.dirname(os.path.realpath(__file__))
> +doc_modules = os.path.join(folder, 'modules')
>  gcc_srcdir = os.path.join(folder, '..', 'gcc')
>  
> +sys.path.insert(0, doc_modules)
> +
>  def read_file(name):
>      path = os.path.join(gcc_srcdir, name)
>      if os.path.exists(path):
> diff --git a/doc/gcc_sphinx.py b/doc/modules/gcc_sphinx.py
> similarity index 100%
> rename from doc/gcc_sphinx.py
> rename to doc/modules/gcc_sphinx.py


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-10  5:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09 21:31 [PATCH] doc: Use a separate directory for new modules we add to PATH Arsen Arsenović
2022-11-09 22:18 ` David Malcolm
2022-11-10  5:26 ` Martin Liška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).