File: support_python3-sphinx

package info (click to toggle)
python-apptools 4.5.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,668 kB
  • sloc: python: 16,754; makefile: 79
file content (25 lines) | stat: -rw-r--r-- 836 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Description: Adding support for python2-only function execfile()
Author: Stewart Ferguson <stew@ferg.aero>
Forwarded: https://github.com/enthought/apptools/pull/84
Last-Update: 2019-01-23
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -13,6 +13,16 @@
 
 import sys, os
 
+def execfile(filepath, globals=None, locals=None):
+    if globals is None:
+        globals = {}
+    globals.update({
+        "__file__": filepath,
+        "__name__": "__main__",
+    })
+    with open(filepath, 'rb') as file:
+        exec(compile(file.read(), filepath, 'exec'), globals, locals)
+
 # If your extensions are in another directory, add it here. If the directory
 # is relative to the documentation root, use os.path.abspath to make it
 # absolute, like shown here.