forked from yr2b/File2LongImage
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
126 lines (119 loc) · 3.67 KB
/
Copy pathsetup.py
File metadata and controls
126 lines (119 loc) · 3.67 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
"""
py2app build script for File2LongImage
Usage:
python setup.py py2app
"""
from setuptools import setup
import sys
import os
# 确保在 macOS 上运行
if sys.platform != 'darwin':
print("This setup script is for macOS only!")
sys.exit(1)
APP = ['mac_app.py']
DATA_FILES = [
('', ['config.py']),
('assets', ['assets/demo.png']),
]
OPTIONS = {
'argv_emulation': False,
'iconfile': 'assets/icon.icns',
'plist': {
'CFBundleName': 'File2LongImage',
'CFBundleDisplayName': 'File2LongImage',
'CFBundleIdentifier': 'com.file2longimage.app',
'CFBundleVersion': '1.0.0',
'CFBundleShortVersionString': '1.0.0',
'NSHumanReadableCopyright': '© 2024 File2LongImage',
'NSHighResolutionCapable': True,
'LSMinimumSystemVersion': '10.14.0',
'NSRequiresAquaSystemAppearance': False, # 支持暗色模式
'CFBundleDocumentTypes': [
{
'CFBundleTypeName': 'PDF Document',
'CFBundleTypeRole': 'Viewer',
'LSItemContentTypes': ['com.adobe.pdf'],
'CFBundleTypeExtensions': ['pdf'],
},
{
'CFBundleTypeName': 'Microsoft Word Document',
'CFBundleTypeRole': 'Viewer',
'CFBundleTypeExtensions': ['doc', 'docx'],
},
{
'CFBundleTypeName': 'Microsoft Excel Document',
'CFBundleTypeRole': 'Viewer',
'CFBundleTypeExtensions': ['xls', 'xlsx', 'csv'],
},
{
'CFBundleTypeName': 'Microsoft PowerPoint Document',
'CFBundleTypeRole': 'Viewer',
'CFBundleTypeExtensions': ['ppt', 'pptx'],
},
{
'CFBundleTypeName': 'Text Document',
'CFBundleTypeRole': 'Viewer',
'CFBundleTypeExtensions': ['txt', 'rtf'],
}
],
'UTExportedTypeDeclarations': [],
'NSAppleEventsUsageDescription': 'File2LongImage needs to control other applications to convert documents.',
'NSDesktopFolderUsageDescription': 'File2LongImage needs access to save converted images.',
'NSDocumentsFolderUsageDescription': 'File2LongImage needs access to read and save documents.',
'NSDownloadsFolderUsageDescription': 'File2LongImage needs access to read files from Downloads.',
},
'packages': [
'PIL',
'pdf2image',
'tkinter',
'subprocess',
'hashlib',
'threading',
'pathlib',
],
'includes': [
'config',
],
'excludes': [
'matplotlib',
'numpy',
'scipy',
'pandas',
'pytest',
'setuptools',
'pip',
],
'resources': [
'output',
'.intermediate',
],
'frameworks': [],
'dylib_excludes': [],
'strip': True,
'optimize': 2,
}
# 尝试包含 Poppler 二进制文件
poppler_path = '/opt/homebrew/bin'
if os.path.exists(poppler_path):
poppler_binaries = [
'pdfinfo',
'pdftocairo',
'pdftotext',
'pdftoppm',
]
for binary in poppler_binaries:
binary_path = os.path.join(poppler_path, binary)
if os.path.exists(binary_path):
DATA_FILES.append(('poppler', [binary_path]))
setup(
name='File2LongImage',
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
install_requires=[
'Pillow>=10.0.0,<11.0.0',
'pdf2image==1.16.3',
'tkinterdnd2',
],
)