File tree 6 files changed +35
-30
lines changed
6 files changed +35
-30
lines changed Original file line number Diff line number Diff line change 2
2
Build script to create a doc-to-pdf convert server as a Windows executable.
3
3
"""
4
4
5
- import os
6
- import textwrap
7
-
8
-
9
- setup_params = dict (
10
- console = ['server.py' ],
11
- options = dict (
12
- py2exe = dict (
13
- packages = ['pkg_resources' ],
14
- ),
15
- ),
16
- script_args = ('py2exe' ,),
17
- )
18
-
19
5
if __name__ == '__main__' :
6
+ import os
7
+ import textwrap
8
+
20
9
from setuptools import setup
21
10
22
11
__import__ ('py2exe' )
25
14
convert.ConvertServer.start_server()
26
15
"""
27
16
open ('server.py' , 'w' ).write (textwrap .dedent (code ))
28
- setup (** setup_params )
17
+ setup (
18
+ console = ['server.py' ],
19
+ options = dict (
20
+ py2exe = dict (
21
+ packages = ['pkg_resources' ],
22
+ ),
23
+ ),
24
+ script_args = ('py2exe' ,), # type: ignore[arg-type] # python/typeshed#12595
25
+ )
29
26
os .remove ('server.py' )
Original file line number Diff line number Diff line change 1
- __path__ = __import__ ('pkgutil' ).extend_path (__path__ , __name__ ) # type: ignore
1
+ __path__ = __import__ ('pkgutil' ).extend_path (__path__ , __name__ )
Original file line number Diff line number Diff line change 1
- import os
2
1
import argparse
2
+ import os
3
3
from contextlib import contextmanager
4
4
5
- from jaraco .path import save_to_file , replace_extension
5
+ from jaraco .path import replace_extension , save_to_file
6
6
7
7
8
8
@contextmanager
@@ -23,10 +23,11 @@ class Converter:
23
23
"""
24
24
25
25
def __init__ (self ):
26
- from win32com .client import Dispatch
27
- import pythoncom
28
26
import threading
29
27
28
+ import pythoncom
29
+ from win32com .client import Dispatch
30
+
30
31
if threading .current_thread ().getName () != 'MainThread' :
31
32
pythoncom .CoInitialize ()
32
33
self .word = Dispatch ('Word.Application' )
@@ -80,13 +81,13 @@ class ConvertServer:
80
81
def index (self ):
81
82
return form
82
83
83
- index .exposed = True # type: ignore
84
+ index .exposed = True # type: ignore[attr-defined]
84
85
85
86
def convert (self , document ):
86
87
cherrypy .response .headers ['Content-Type' ] = 'application/pdf'
87
88
return Converter ().convert (document .file .read ())
88
89
89
- convert .exposed = True # type: ignore
90
+ convert .exposed = True # type: ignore[attr-defined]
90
91
91
92
@staticmethod
92
93
def start_server ():
Original file line number Diff line number Diff line change 1
- import re
1
+ from __future__ import annotations
2
2
3
- from win32com . client import Dispatch
3
+ import re
4
4
5
+ from win32com .client import Dispatch , dynamic
5
6
6
7
try :
7
- app = Dispatch ('Excel.Application' )
8
+ app : dynamic . CDispatch | None = Dispatch ('Excel.Application' )
8
9
except Exception :
9
10
app = None
10
11
Original file line number Diff line number Diff line change @@ -13,3 +13,11 @@ explicit_package_bases = True
13
13
disable_error_code =
14
14
# Disable due to many false positives
15
15
overload-overlap,
16
+
17
+ # jaraco/jaraco.path#2
18
+ [mypy-jaraco.path.*]
19
+ ignore_missing_imports = True
20
+
21
+ # cherrypy/cherrypy#1510
22
+ [mypy-cherrypy.*]
23
+ ignore_missing_imports = True
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ test = [
33
33
" pytest >= 6, != 8.1.*" ,
34
34
35
35
# local
36
- ' pypiwin32 ; platform_system == "Windows"' ,
36
+ ' pywin32 ; platform_system == "Windows"' ,
37
37
]
38
38
39
39
doc = [
@@ -65,6 +65,8 @@ type = [
65
65
" pytest-mypy" ,
66
66
67
67
# local
68
+ " types-pywin32" ,
69
+ " types-setuptools" ,
68
70
]
69
71
70
72
@@ -74,7 +76,3 @@ doc-to-pdf-server = "jaraco.office.convert:ConvertServer.start_server"
74
76
75
77
76
78
[tool .setuptools_scm ]
77
-
78
-
79
- [tool .pytest-enabler .mypy ]
80
- # Disabled due to jaraco/skeleton#143
You can’t perform that action at this time.
0 commit comments