File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737 env :
3838 MACOSX_DEPLOYMENT_TARGET : 10.15
3939 CIBW_ARCHS_MACOS : auto universal2
40- CIBW_SKIP : " *-win32 *-manylinux_i686"
40+ CIBW_SKIP : " *-win32 *-manylinux_i686 cp312-win_amd64 cp37-musllinux_x86_64 "
4141 CIBW_BUILD_VERBOSITY : 1
4242 - name : Verify clean directory
4343 run : git diff --exit-code
Original file line number Diff line number Diff line change 3636 "test" : ["pytest>=6.0" ],
3737 },
3838 conan_profile_settings = {"compiler.cppstd" : "20" },
39+ entry_points = {
40+ "console_scripts" : ["pyodr=pyodr.cli:main" ],
41+ },
3942)
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 11#include < pybind11/pybind11.h>
2+ #include < pybind11/stl.h>
23
34#include < odr/document.hpp>
45#include < odr/document_element.hpp>
You can’t perform that action at this time.
0 commit comments