File tree Expand file tree Collapse file tree 3 files changed +35
-9
lines changed Expand file tree Collapse file tree 3 files changed +35
-9
lines changed Original file line number Diff line number Diff line change 3
3
VERSION=` python -c ' import sys; sys.path.append("../src"); import crystal; print(crystal.__version__)' `
4
4
5
5
rm -rf build dist dist-mac
6
- poetry run python setup.py py2app
6
+
7
+ # Build .app
8
+ if [ " $1 " != " --app-only" ]; then
9
+ GRAPH_OPT=" "
10
+ else
11
+ # --graph: Generates a GraphViz .dot file in the build directory that shows
12
+ # the calculated module dependency graph
13
+ GRAPH_OPT=" --graph"
14
+ fi
15
+ poetry run python setup.py py2app $GRAPH_OPT
16
+
17
+ # Slim .app
18
+ zip " dist/Crystal Web Archiver.app/Contents/Resources/lib/python39.zip" \
19
+ -d " wx/locale/*"
20
+
21
+ # Build .dmg
7
22
mkdir dist-mac
8
23
if [ " $1 " != " --app-only" ]; then
9
24
echo ' Building disk image... (skip with --app-only option)'
10
- hdiutil create -srcfolder dist -volname " Crystal Web Archiver" -format UDZO dist-mac/crystal-mac-$VERSION .dmg
25
+ # -format UDBZ: Use bzip2 compression, which produces smaller images
26
+ # than zlib compression (UDZO), even with zlib-level=9
27
+ hdiutil create -srcfolder dist -volname " Crystal Web Archiver" -format UDBZ dist-mac/crystal-mac-$VERSION .dmg
11
28
fi
Original file line number Diff line number Diff line change 64
64
'argv_emulation' : False ,
65
65
'iconfile' : 'media/AppIconMac.icns' ,
66
66
'plist' : PLIST ,
67
+ 'excludes' : [
68
+ 'numpy' ,
69
+ 'test' , # CPython test data
70
+ 'PIL' ,
71
+ ]
67
72
}},
68
73
)
69
74
elif sys .platform == 'win32' :
Original file line number Diff line number Diff line change 1
1
from contextlib import contextmanager
2
2
import os
3
- import pyscreeze
4
3
import sys
5
4
from typing import Iterator
6
5
@@ -13,11 +12,16 @@ def screenshot_if_raises() -> Iterator[None]:
13
12
# Take screenshot if screenshots directory path defined
14
13
screenshots_dirpath = os .environ .get ('CRYSTAL_SCREENSHOTS_DIRPATH' )
15
14
if screenshots_dirpath is not None :
16
- os .makedirs (screenshots_dirpath , exist_ok = True )
17
-
18
- screenshot_filename = os .environ .get ('CRYSTAL_SCREENSHOT_ID' , 'screenshot' ) + '.png'
19
- screenshot_filepath = os .path .join (screenshots_dirpath , screenshot_filename )
20
- print ('*** Saving screenshot to: ' + os .path .abspath (screenshot_filepath ), file = sys .stderr )
21
- pyscreeze .screenshot (screenshot_filepath )
15
+ try :
16
+ import pyscreeze
17
+ except ImportError : # probably PIL missing
18
+ print ('*** Unable to save screenshot because pyscreeze not available. Probably PIL is missing.' , file = sys .stderr )
19
+ else :
20
+ os .makedirs (screenshots_dirpath , exist_ok = True )
21
+
22
+ screenshot_filename = os .environ .get ('CRYSTAL_SCREENSHOT_ID' , 'screenshot' ) + '.png'
23
+ screenshot_filepath = os .path .join (screenshots_dirpath , screenshot_filename )
24
+ print ('*** Saving screenshot to: ' + os .path .abspath (screenshot_filepath ), file = sys .stderr )
25
+ pyscreeze .screenshot (screenshot_filepath )
22
26
23
27
raise
You can’t perform that action at this time.
0 commit comments