Skip to content

Commit cb4dfcb

Browse files
committed
write tool to compare the example repos
1 parent 8bd1e04 commit cb4dfcb

File tree

2 files changed

+79
-14
lines changed

2 files changed

+79
-14
lines changed

build/examples.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env python3
2+
3+
import filecmp
4+
import os
5+
import subprocess
6+
7+
# script to keep the examples in sync [fry 210808]
8+
9+
# when changes are found, stop and open a visual diff tool to examine
10+
DIFF_THE_MODS = False
11+
12+
# location of the Kaleidoscope diff command
13+
KSDIFF = '/usr/local/bin/ksdiff'
14+
15+
# location of the Xcode FileMerge command
16+
# FILE_MERGE = '/Applications/Xcode.app/Contents/Applications/FileMerge.app'
17+
# FILE_MERGE = '/Applications/Xcode.app/Contents/Applications/FileMerge.app/Contents/MacOS/FileMerge'
18+
FILE_MERGE = '/usr/bin/opendiff'
19+
20+
if os.path.exists(KSDIFF):
21+
DIFF_TOOL = KSDIFF
22+
else:
23+
DIFF_TOOL = FILE_MERGE
24+
25+
# contains Basics, Demos, Topics
26+
EXAMPLES_DIR = os.path.realpath('../../processing-docs/content/examples')
27+
28+
# contains Basic Examples, Topic Examples
29+
P4_DOCS_REPO = os.path.realpath('../../processing-other/website/content/examples')
30+
31+
32+
def run_command(args):
33+
# process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE)
34+
process = subprocess.Popen(args, stdout=subprocess.PIPE)
35+
while True:
36+
output = process.stdout.readline()
37+
# if output == '' and process.poll() is not None: # hangs on Python 3
38+
if process.poll() is not None:
39+
break
40+
if output:
41+
print(output.strip())
42+
rc = process.poll()
43+
return rc
44+
45+
46+
# walk two directories and match .pde files in both locations
47+
def handle(examples_folder, web_folder):
48+
for root, dirs, files in os.walk(examples_folder):
49+
for file in files:
50+
if file.endswith('.pde'):
51+
ex_path = os.path.join(root, file)
52+
rel_path = ex_path[len(examples_folder)+1:]
53+
# print(rel_path)
54+
web_path = os.path.join(web_folder, rel_path)
55+
# print(web_path)
56+
status = ' '
57+
if not os.path.exists(web_path):
58+
status = 'missing '
59+
elif not filecmp.cmp(ex_path, web_path, shallow=True):
60+
status = 'modified '
61+
if DIFF_THE_MODS:
62+
run_command([ DIFF_TOOL, ex_path, web_path ])
63+
exit()
64+
print(f'{status} {rel_path}')
65+
66+
67+
if __name__ == "__main__":
68+
handle(f'{EXAMPLES_DIR}/Basics', f'{P4_DOCS_REPO}/Basic Examples')
69+
handle(f'{EXAMPLES_DIR}/Topics', f'{P4_DOCS_REPO}/Topic Examples')

todo.txt

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ o put stdout/stderr into ~/Library/Logs
5656
o and have a .log extension so it can be browsed properly
5757
o need to make sure that it's ok to write to logs dir..
5858
o probably being removed from future OS X versions
59+
o create a processing4-docs repo
60+
o check with Casey re: shallow clone or approach
61+
o show the recommended sw version for users' platform on the download page
5962

6063
fixed in 3.0a1
6164
X Processing is named processing-app-Base in Gnome 3
@@ -138,6 +141,7 @@ _ load examples from pdez files
138141
_ 250 example (folders), would cut ~8-900 files to just those 250
139142
_ https://github.com/processing/processing/issues/182
140143
_ examples window sketches should load in proper environment
144+
_ if Java Mode is in front, and user double-clicks another Mode's entry, what happens?
141145
_ write build.xml file to automatically update the examples
142146
_ when adding a new library, its examples aren't added to the list until restart
143147

@@ -176,11 +180,6 @@ _ https://fonts.google.com/specimen/Space+Grotesk
176180
_ Implement support for Java “modules” and clean up JavaFX-specific workarounds
177181
_ https://github.com/processing/processing4/issues/212
178182

179-
_ add a Tool for removing extended attributes? xattr -cr /path/to/Something.app
180-
_ when exporting an app, run xattr on it to handle "app is damaged" errors?
181-
_ https://osxdaily.com/2019/02/13/fix-app-damaged-cant-be-opened-trash-error-mac/
182-
_ https://github.com/processing/processing/issues/4214
183-
184183
_ when lib downloads (batik) go dead, fallback to the download.processing.org version
185184
_ or for now, tell users how to do it manually
186185

@@ -243,6 +242,10 @@ _ then pass through the source to update licenses
243242
_ add Processing Foundation as 2012-15
244243
_ update license info to state gplv2 not v3
245244
_ run through that online license checker
245+
_ add a Tool for removing extended attributes? xattr -cr /path/to/Something.app
246+
_ when exporting an app, run xattr on it to handle "app is damaged" errors?
247+
_ https://osxdaily.com/2019/02/13/fix-app-damaged-cant-be-opened-trash-error-mac/
248+
_ https://github.com/processing/processing/issues/4214
246249

247250
after initial 4.0 release
248251
_ startup is so incredibly slow
@@ -264,7 +267,6 @@ _ single file thing is long gone
264267
_ introduce the idea of 'scraps' (ala gist) that are just single page blobs
265268

266269

267-
268270
windows
269271
_ go back to including a .bat file?
270272
_ .\java\bin\java.exe -cp lib/pde.jar;core/library/core.jar;lib/jna.jar;lib/jna-platform.jar;lib/antlr-4.7.2-complete.jar;lib/ant.jar;lib/ant-launcher.jar -Djna.nosys=true -Dsun.java2d.uiScale.enabled=false -Djna.boot.library.path=lib -Djna.nounpack=true -Dsun.java2d.d3d=false -Dsun.java2d.ddoffscreen=false -Dsun.java2d.noddraw=true processing.app.Base
@@ -286,14 +288,6 @@ _ sign releases on Windows to avoid SmartScreen warnings/errors
286288
_ https://github.com/processing/processing4/issues/25
287289

288290

289-
web/docs
290-
_ create a processing4-docs repo
291-
_ check with Casey re: shallow clone or approach
292-
_ show the recommended sw version for users' platform on the download page
293-
294-
295-
_ reliable getLibraryFolder() and getDocumentsFolder() methods in MacPlatform
296-
_ https://github.com/processing/processing4/issues/9
297291
_ i18n support for Modes
298292
_ https://github.com/processing/processing/commit/0ed2fc139c3c5dfe0a1702ed8348987b3c6a5c9d
299293
_ update installation guide for Linux
@@ -1137,6 +1131,8 @@ _ don't re-copy JRE into work folder if already exists
11371131
_ implement a splash screen
11381132

11391133
others
1134+
_ reliable getLibraryFolder() and getDocumentsFolder() methods in MacPlatform
1135+
_ https://github.com/processing/processing4/issues/9
11401136
_ disable "notifications" prompt on startup for macOS
11411137
_ https://github.com/processing/processing4/issues/234
11421138
_ we're not posting any, can we suppress the "allow notifications" message?

0 commit comments

Comments
 (0)