File tree Expand file tree Collapse file tree 4 files changed +45
-1
lines changed Expand file tree Collapse file tree 4 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 37
37
env :
38
38
MACOSX_DEPLOYMENT_TARGET : 10.15
39
39
CIBW_ARCHS_MACOS : auto universal2
40
- CIBW_SKIP : " *-win32 *-manylinux_i686"
40
+ CIBW_SKIP : " *-win32 *-manylinux_i686 cp312-win_amd64 cp37-musllinux_x86_64 "
41
41
CIBW_BUILD_VERBOSITY : 1
42
42
- name : Verify clean directory
43
43
run : git diff --exit-code
Original file line number Diff line number Diff line change 36
36
"test" : ["pytest>=6.0" ],
37
37
},
38
38
conan_profile_settings = {"compiler.cppstd" : "20" },
39
+ entry_points = {
40
+ "console_scripts" : ["pyodr=pyodr.cli:main" ],
41
+ },
39
42
)
Original file line number Diff line number Diff line change
1
+ import sys
2
+ import argparse
3
+ from pathlib import Path
4
+ from typing import Sequence
5
+ import tempfile
6
+ import webbrowser
7
+
8
+ import pyodr .core as core
9
+
10
+
11
+ def main (args : Sequence [str ] | None = None ) -> int :
12
+ parser = argparse .ArgumentParser (description = "OpenDocument Reader" )
13
+ parser .add_argument ("file" , type = Path , help = "The file to open" )
14
+ args = parser .parse_args (args )
15
+
16
+ html_config = core .HtmlConfig ()
17
+
18
+ print (f"Opening file: { str (args .file )} " )
19
+ file = core .open (str (args .file ))
20
+ if not file .is_valid ():
21
+ print (f"Unable to open" )
22
+ return 1
23
+ print (f"Type detected as { file .file_type ()} " )
24
+
25
+ tmp_dir = Path (tempfile .mkdtemp (prefix = "pyodr-" , suffix = ".tmp" ))
26
+ print (f"Translating html to { str (tmp_dir )} " )
27
+ html = core .html .translate (file , str (tmp_dir ), html_config )
28
+ print ("Done" )
29
+
30
+ for page in html .pages ():
31
+ url = f"file://{ str (page .path )} "
32
+ print (f"Opening { page .name } via { url } " )
33
+ webbrowser .open (url )
34
+
35
+ return 0
36
+
37
+
38
+ if __name__ == '__main__' :
39
+ error = main ()
40
+ sys .exit (error )
Original file line number Diff line number Diff line change 1
1
#include < pybind11/pybind11.h>
2
+ #include < pybind11/stl.h>
2
3
3
4
#include < odr/document.hpp>
4
5
#include < odr/document_element.hpp>
You can’t perform that action at this time.
0 commit comments