Dear AmForthers,
I had pointed out that I use an old version of amforth-upload.py, because newer ones did not work for me. So I spent some time with this. Short version for "trunk": The expanded path of the filename given as argument is not passed on to be opened. Please find two patches below, one for version 4.9, one for trunk. The changes fix uploading one or two (hopefully more) files, however, I have not tested any #include trickery. So if someone else would please be so kind as to test the patch for trunk on their environment, it would be much appreciated. Happy forthing, Erich --- the gory details ------------------------------------------------- 1. using md5sum and a little shell acrobatics one can find there are seven different versions of this script: a6e355913f567148d6129638d1979dd0 releases/2.7/tools/amforth-upload.py d98ce0c817fd19cba4474e13b56f566f releases/3.4/tools/amforth-upload.py c0a6266c243a724da85074fc6a7bc315 releases/4.0/tools/amforth-upload.py 3f6c0a9b8616e4636a2cc9f06d1ede10 releases/4.1/tools/amforth-upload.py 7bee7d2eb669aad5c4b77c93c74d1941 releases/4.7/tools/amforth-upload.py e8f55df9f17ceb38228ba68270ca019d releases/4.9/tools/amforth-upload.py faf3f05fbb4126a290d435e83e3e90ee releases/5.7/tools/amforth-upload.py faf3f05fbb4126a290d435e83e3e90ee trunk/tools/amforth-upload.py I happen to use the one from release 4.0. 2. using more shell acrobatics # --- doit.sh ---------------------------------------------- #!/bin/bash CONSOLE=/dev/ttyUSB1 TOP=$HOME/Forth/amforth export R="" for R in 2.7 3.4 4.0 4.1 4.7 4.9 5.7 do echo "--- $R ---" cat <<EOF > ./t_up-${R}.fs \ Blafasel ${R} marker --up${R}-- : msg ." this is uploader rev $R" cr ; msg EOF cat ./t_up-${R}.fs $TOP/releases/$R/tools/amforth-upload.py -v -t $CONSOLE ./t_up-$R.fs done # ---------------------------------------------------------- and a controller shows that versions up to and including 4.7 work for me. This narrows the questionable change down to version 4.8->4.9. 3. "printf-Style" debugging lead me into function "search_and_open_file". And into the low-lands of a triple for-loop. Where once the item in question was found, the loops did not stop. So a "break" in the innermost loop would fix it. At least for uploading "one" file. Or two files. I did not test any #include trickery. #+begin_src diff ew@ceres:~/eGeek/sourceforge.net/amforth-code/releases/4.9/tools 30 > svn diff --extensions --ignore-space-change Index: amforth-upload.py =================================================================== --- amforth-upload.py (revision 2442) +++ amforth-upload.py (working copy) @@ -55,6 +55,7 @@ filedirs[f].append([root]) else: filedirs[f]=[root] + break if len(filedirs[f])==1: print "using ", f," from", filedirs[f][0] filehandle = file(os.path.join(filedirs[f][0], f)) #+end_src This works for the script in Version 4.9. not for trunk! 4. The script in version "trunk" is even more involved in the same triple for-loop area. However, it seems the the beautifully crafted filename is in the end not handed on to open the file. #+begin_src diff ew@ceres:~/Forth/atmega2/17_amforth_maint/03_amforth-upload 114 > diff -wu amforth-upload-trunk.py.orig amforth-upload-trunk.py --- amforth-upload-trunk.py.orig 2020-08-01 15:39:27.148283400 +0200 +++ amforth-upload-trunk.py 2020-08-01 16:04:50.262624068 +0200 @@ -59,9 +59,10 @@ if fpath: filedirs[f].append(fpath) else: filedirs[f]=[fpath] + break if len(filedirs[basefilename])==1: - print "\nusing ", filename," from", filedirs[filename][0] - filehandle = file(filedirs[filename][0]) + print "\nusing ", fpath + filehandle = file(fpath) return filehandle else: # oops, too many files or no one at all no file found? #+end_src Again, I have not tested any #include trickery. -- May the Forth be with you ... _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel