Thanks for both of you. I chose Eric's method. This is what I augmented my
conf.py file, in case other readers will have a similar question:
def remove_copied_files(app, exception):
os.remove('source/README.md')
def setup(app):
app.connect('build-finished', remove_copied_files)
# Rest of the function body ...
@Eric What is the advantage of your method compared to that of Takeshi
Komiya? I can think of the following: one can use Python's cross-platform
functions (os.remove in my case), so I do not have to edit both Makefile
and make.bat). Other advantages?
Other question: how can I close this thread with a "Solved" tag?
On Sunday, 25 October 2020 at 19:35:08 UTC+1 [email protected] wrote:
> Or maybe connect to the build-finished event?
>
>
> https://www.sphinx-doc.org/en/master/extdev/appapi.html#event-build-finished
>
> Eric
>
>
> On Sun, Oct 25, 2020 at 12:15 PM Komiya Takeshi <[email protected]> wrote:
>
>> Hi,
>>
>> How about add an instruction into Makefile? I believe it's very simple!
>>
>> Thanks,
>> Takeshi KOMIYA
>>
>> 2020年10月22日(木) 19:34 Zoltan <[email protected]>:
>> >
>> >
>> > I need to copy a file before the documentation generation starts. I put
>> this to the beginning of conf.py:
>> >
>> > from shutil import copy
>> > copy('../../README.md', '.')
>> >
>> > I want to delete this file after the documentation has been generated.
>> How can I instruct Sphinx to execute code after the generation?
>> >
>> > --
>> > 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/bb5f66de-4664-4673-a293-37e3eacd314cn%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/CAFmkQANcH92JOkusUAympaLFm3CZb7FwWNVoYCGtoENw8-%3Du8w%40mail.gmail.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/3b88c54a-a1c2-4682-b589-0ecc162d7089n%40googlegroups.com.