scons-xo-exts-lib 1.1.0__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of scons-xo-exts-lib might be problematic. Click here for more details.
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/PKG-INFO +1 -1
- scons_xo_exts_lib-1.2.0/src/scons_xo_exts_lib/Builders/orgmode.py +109 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/__init__.py +1 -1
- scons_xo_exts_lib-1.1.0/src/scons_xo_exts_lib/Builders/orgmode.py +0 -52
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/README.md +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/pyproject.toml +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Actions/Uv.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Actions/__init__.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/BuildSupport/Make.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/BuildSupport/NodeMangling.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/BuildSupport/__init__.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/__init__.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/bazel.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/cmake.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/dotnet.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/dune.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/elisp.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/elixir.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/make.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/meson.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/ninja.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/pandoc.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/racket.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Find.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/GenericExtensions.py +0 -0
- {scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Read.py +0 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
import subprocess
|
|
10
|
+
|
|
11
|
+
from shutil import move
|
|
12
|
+
|
|
13
|
+
from SCons.Script import Builder
|
|
14
|
+
|
|
15
|
+
from scons_xo_exts_lib.BuildSupport import NodeMangling
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _orgmode_extension_to_backend(file_extension: str) -> list[str]:
|
|
19
|
+
match file_extension:
|
|
20
|
+
case "info":
|
|
21
|
+
return "texinfo"
|
|
22
|
+
case "markdown":
|
|
23
|
+
return "md"
|
|
24
|
+
case "pdf":
|
|
25
|
+
return "latex"
|
|
26
|
+
case "texi":
|
|
27
|
+
return "texinfo"
|
|
28
|
+
case _:
|
|
29
|
+
return file_extension
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _orgmode_extension_to_libraries(file_extension: str) -> list[str]:
|
|
33
|
+
elisp_libs = []
|
|
34
|
+
|
|
35
|
+
backend = _orgmode_extension_to_backend(file_extension=file_extension)
|
|
36
|
+
|
|
37
|
+
if backend != file_extension:
|
|
38
|
+
elisp_libs.append(f"ox-{backend}")
|
|
39
|
+
|
|
40
|
+
return elisp_libs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _orgmode_get_export_flags(target_file: str, source_file: str) -> str:
|
|
44
|
+
file_extension = os.path.splitext(target_file)[1][1:]
|
|
45
|
+
backend = _orgmode_extension_to_backend(file_extension=file_extension)
|
|
46
|
+
|
|
47
|
+
if file_extension == "texi":
|
|
48
|
+
fun = "org-texinfo-export-to-texinfo"
|
|
49
|
+
else:
|
|
50
|
+
fun = f"org-{backend}-export-to-{file_extension}"
|
|
51
|
+
|
|
52
|
+
load_elisp_libs = [
|
|
53
|
+
"org",
|
|
54
|
+
"ox-latex",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
extension_libs = _orgmode_extension_to_libraries(file_extension=file_extension)
|
|
58
|
+
|
|
59
|
+
load_elisp_libs.extend(extension_libs)
|
|
60
|
+
|
|
61
|
+
load_flags = " ".join([f"-l {s}" for s in load_elisp_libs])
|
|
62
|
+
flags = f"{load_flags} {source_file} -f {fun}"
|
|
63
|
+
|
|
64
|
+
return flags
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def orgmode_action(target, source, env):
|
|
68
|
+
emacs_exe = env.get("EMACS_EXE", "emacs")
|
|
69
|
+
emacs_exec_flags = env.get("EMACS_EXEC_FLAGS", "-batch -q --no-site-file")
|
|
70
|
+
|
|
71
|
+
cwd = NodeMangling.get_first_directory(source)
|
|
72
|
+
|
|
73
|
+
inp = NodeMangling.get_first_node(source).abspath
|
|
74
|
+
out = NodeMangling.get_first_node(target).abspath
|
|
75
|
+
|
|
76
|
+
orgmode_flags = _orgmode_get_export_flags(target_file=out, source_file=inp)
|
|
77
|
+
flags = f"{emacs_exec_flags} {orgmode_flags}"
|
|
78
|
+
|
|
79
|
+
cmd = f"{emacs_exe} {flags}"
|
|
80
|
+
|
|
81
|
+
print(cmd)
|
|
82
|
+
|
|
83
|
+
result = subprocess.run(
|
|
84
|
+
args=cmd,
|
|
85
|
+
capture_output=False,
|
|
86
|
+
check=False,
|
|
87
|
+
shell=True,
|
|
88
|
+
cwd=cwd,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
# When the target basename is different than export basename we have to do
|
|
92
|
+
# a file move.
|
|
93
|
+
if not os.path.exists(out):
|
|
94
|
+
out_extension = os.path.splitext(out)[1]
|
|
95
|
+
inp_basename = os.path.splitext(inp)[0]
|
|
96
|
+
|
|
97
|
+
move(f"{inp_basename}{out_extension}", out)
|
|
98
|
+
|
|
99
|
+
return result.returncode
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def generate(env):
|
|
103
|
+
orgmode_file_builder = Builder(action=orgmode_action)
|
|
104
|
+
|
|
105
|
+
env.Append(BUILDERS={"OrgmodeFile": orgmode_file_builder})
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def exists(env):
|
|
109
|
+
return env.Detect("orgmode")
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
|
|
3
|
-
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
-
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import os
|
|
9
|
-
import subprocess
|
|
10
|
-
|
|
11
|
-
from SCons.Script import Builder
|
|
12
|
-
|
|
13
|
-
from scons_xo_exts_lib.BuildSupport import NodeMangling
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def orgmode_action(target, source, env):
|
|
17
|
-
emacs_exe = env.get("EMACS_EXE", "emacs")
|
|
18
|
-
emacs_exec_flags = env.get("EMACS_EXEC_FLAGS", "-batch -q --no-site-file")
|
|
19
|
-
|
|
20
|
-
cwd = NodeMangling.get_first_directory(source)
|
|
21
|
-
|
|
22
|
-
inp = NodeMangling.get_first_node(source).abspath
|
|
23
|
-
out = NodeMangling.get_first_node(target).abspath
|
|
24
|
-
|
|
25
|
-
ext = os.path.splitext(out)[1][1:]
|
|
26
|
-
fun = f'(org-export-to-file \'{ext} \\"{out}\\")'
|
|
27
|
-
|
|
28
|
-
load_flags = "-l org -l ox-latex"
|
|
29
|
-
flags = f'{emacs_exec_flags} {load_flags} {inp} --eval "{fun}"'
|
|
30
|
-
|
|
31
|
-
cmd = f"{emacs_exe} {flags}"
|
|
32
|
-
print(cmd)
|
|
33
|
-
|
|
34
|
-
result = subprocess.run(
|
|
35
|
-
args=cmd,
|
|
36
|
-
capture_output=False,
|
|
37
|
-
check=False,
|
|
38
|
-
shell=True,
|
|
39
|
-
cwd=cwd,
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
return result.returncode
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def generate(env):
|
|
46
|
-
orgmode_file_builder = Builder(action=orgmode_action)
|
|
47
|
-
|
|
48
|
-
env.Append(BUILDERS={"OrgmodeFile": orgmode_file_builder})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def exists(env):
|
|
52
|
-
return env.Detect("orgmode")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Actions/__init__.py
RENAMED
|
File without changes
|
{scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/BuildSupport/Make.py
RENAMED
|
File without changes
|
|
File without changes
|
{scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/BuildSupport/__init__.py
RENAMED
|
File without changes
|
{scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/dotnet.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/elixir.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/pandoc.py
RENAMED
|
File without changes
|
{scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/Builders/racket.py
RENAMED
|
File without changes
|
|
File without changes
|
{scons_xo_exts_lib-1.1.0 → scons_xo_exts_lib-1.2.0}/src/scons_xo_exts_lib/GenericExtensions.py
RENAMED
|
File without changes
|
|
File without changes
|