write tool to compare the example repos

This commit is contained in:
Ben Fry
2021-08-08 12:44:23 -04:00
parent 8bd1e04b74
commit cb4dfcb9fc
2 changed files with 79 additions and 14 deletions

69
build/examples.py Executable file
View File

@@ -0,0 +1,69 @@
#!/usr/bin/env python3
import filecmp
import os
import subprocess
# script to keep the examples in sync [fry 210808]
# when changes are found, stop and open a visual diff tool to examine
DIFF_THE_MODS = False
# location of the Kaleidoscope diff command
KSDIFF = '/usr/local/bin/ksdiff'
# location of the Xcode FileMerge command
# FILE_MERGE = '/Applications/Xcode.app/Contents/Applications/FileMerge.app'
# FILE_MERGE = '/Applications/Xcode.app/Contents/Applications/FileMerge.app/Contents/MacOS/FileMerge'
FILE_MERGE = '/usr/bin/opendiff'
if os.path.exists(KSDIFF):
DIFF_TOOL = KSDIFF
else:
DIFF_TOOL = FILE_MERGE
# contains Basics, Demos, Topics
EXAMPLES_DIR = os.path.realpath('../../processing-docs/content/examples')
# contains Basic Examples, Topic Examples
P4_DOCS_REPO = os.path.realpath('../../processing-other/website/content/examples')
def run_command(args):
# process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE)
process = subprocess.Popen(args, stdout=subprocess.PIPE)
while True:
output = process.stdout.readline()
# if output == '' and process.poll() is not None: # hangs on Python 3
if process.poll() is not None:
break
if output:
print(output.strip())
rc = process.poll()
return rc
# walk two directories and match .pde files in both locations
def handle(examples_folder, web_folder):
for root, dirs, files in os.walk(examples_folder):
for file in files:
if file.endswith('.pde'):
ex_path = os.path.join(root, file)
rel_path = ex_path[len(examples_folder)+1:]
# print(rel_path)
web_path = os.path.join(web_folder, rel_path)
# print(web_path)
status = ' '
if not os.path.exists(web_path):
status = 'missing '
elif not filecmp.cmp(ex_path, web_path, shallow=True):
status = 'modified '
if DIFF_THE_MODS:
run_command([ DIFF_TOOL, ex_path, web_path ])
exit()
print(f'{status} {rel_path}')
if __name__ == "__main__":
handle(f'{EXAMPLES_DIR}/Basics', f'{P4_DOCS_REPO}/Basic Examples')
handle(f'{EXAMPLES_DIR}/Topics', f'{P4_DOCS_REPO}/Topic Examples')

View File

@@ -56,6 +56,9 @@ o put stdout/stderr into ~/Library/Logs
o and have a .log extension so it can be browsed properly
o need to make sure that it's ok to write to logs dir..
o probably being removed from future OS X versions
o create a processing4-docs repo
o check with Casey re: shallow clone or approach
o show the recommended sw version for users' platform on the download page
fixed in 3.0a1
X Processing is named processing-app-Base in Gnome 3
@@ -138,6 +141,7 @@ _ load examples from pdez files
_ 250 example (folders), would cut ~8-900 files to just those 250
_ https://github.com/processing/processing/issues/182
_ examples window sketches should load in proper environment
_ if Java Mode is in front, and user double-clicks another Mode's entry, what happens?
_ write build.xml file to automatically update the examples
_ when adding a new library, its examples aren't added to the list until restart
@@ -176,11 +180,6 @@ _ https://fonts.google.com/specimen/Space+Grotesk
_ Implement support for Java “modules” and clean up JavaFX-specific workarounds
_ https://github.com/processing/processing4/issues/212
_ add a Tool for removing extended attributes? xattr -cr /path/to/Something.app
_ when exporting an app, run xattr on it to handle "app is damaged" errors?
_ https://osxdaily.com/2019/02/13/fix-app-damaged-cant-be-opened-trash-error-mac/
_ https://github.com/processing/processing/issues/4214
_ when lib downloads (batik) go dead, fallback to the download.processing.org version
_ or for now, tell users how to do it manually
@@ -243,6 +242,10 @@ _ then pass through the source to update licenses
_ add Processing Foundation as 2012-15
_ update license info to state gplv2 not v3
_ run through that online license checker
_ add a Tool for removing extended attributes? xattr -cr /path/to/Something.app
_ when exporting an app, run xattr on it to handle "app is damaged" errors?
_ https://osxdaily.com/2019/02/13/fix-app-damaged-cant-be-opened-trash-error-mac/
_ https://github.com/processing/processing/issues/4214
after initial 4.0 release
_ startup is so incredibly slow
@@ -264,7 +267,6 @@ _ single file thing is long gone
_ introduce the idea of 'scraps' (ala gist) that are just single page blobs
windows
_ go back to including a .bat file?
_ .\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
_ https://github.com/processing/processing4/issues/25
web/docs
_ create a processing4-docs repo
_ check with Casey re: shallow clone or approach
_ show the recommended sw version for users' platform on the download page
_ reliable getLibraryFolder() and getDocumentsFolder() methods in MacPlatform
_ https://github.com/processing/processing4/issues/9
_ i18n support for Modes
_ https://github.com/processing/processing/commit/0ed2fc139c3c5dfe0a1702ed8348987b3c6a5c9d
_ update installation guide for Linux
@@ -1137,6 +1131,8 @@ _ don't re-copy JRE into work folder if already exists
_ implement a splash screen
others
_ reliable getLibraryFolder() and getDocumentsFolder() methods in MacPlatform
_ https://github.com/processing/processing4/issues/9
_ disable "notifications" prompt on startup for macOS
_ https://github.com/processing/processing4/issues/234
_ we're not posting any, can we suppress the "allow notifications" message?