diff --git a/manual/index.rst b/manual/index.rst index b8f98a5561..fa19761b1b 100755 --- a/manual/index.rst +++ b/manual/index.rst @@ -38,6 +38,7 @@ Sections glossary +.. REMOVE_IN_PDF The main |app| user interface ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/setup/publish.py b/setup/publish.py index 40d002ee8a..ec4b7b31eb 100644 --- a/setup/publish.py +++ b/setup/publish.py @@ -84,7 +84,8 @@ class Manual(Command): '-d', '.build/doctrees', '.', '.build/html']) subprocess.check_call(['sphinx-build', '-b', 'myepub', '-d', '.build/doctrees', '.', '.build/epub']) - subprocess.check_call(['sphinx-build', '-b', 'mylatex', '-d', + with self: + subprocess.check_call(['sphinx-build', '-b', 'mylatex', '-d', '.build/doctrees', '.', '.build/latex']) pwd = os.getcwdu() os.chdir('.build/latex') @@ -107,6 +108,18 @@ class Manual(Command): if os.path.exists(path): shutil.rmtree(path) + def __enter__(self): + with open('index.rst', 'r+b') as f: + raw = self.orig_index = f.read() + f.seek(0) + f.truncate() + pos = raw.index(b'.. REMOVE_IN_PDF') + f.write(raw[:pos]) + + def __exit__(self, *args): + with open('index.rst', 'wb') as f: + f.write(self.orig_index) + class TagRelease(Command): description = 'Tag a new release in git'