[Rest2web-develop] Bug & feature request about file keyword in restindex
Brought to you by:
mjfoord
From: Andrew I. <and...@us...> - 2006-01-28 20:59:11
|
(This e-mail started as part of a private exchange; per Fuzzyman's request I'm posting it to the dev list.) [files get copied on every build] I noticed that if I use the "file" keyword in the restindex, the file gets copied every time, which resets its datetime stamp, which makes sitecopy (webdav site uploader, http://www.lyra.org/sitecopy/) think it is a new file, so the file gets uploaded every time. I know I can just deposit the file in the output directory once and not reference it in the rest2web source, but I want to keep my "build" files in one place. Can you make the file keyword work like building from source: only copy the file if it is newer than the destination? Fuzzyman's response: 'file' is one of the features I don't use, I added it as a feature request for someone else. I can get rest2web to check the compare directory first though. Should it check file contents or just the timestamp ? Me: Have it check the timestamp. I don't see a need to compare file contents just yet - and that may be unnecessary anyway, as I can always dump the file into the output directory without using rest2web. [file, path] I have several file= keywords in my root index, like so: file: rp.css file: rplogo.png file: halloffamelogo.png I have another file= keyword in my projects/rest2web/restandmacros.txt, pointing to itself (that's my rest-and-html-and-macros playground, so I want others to see the actual source file), but the keyword file: restandmacros.txt in it fails with this error: Traceback (most recent call last): [err] File "/home/aji/code/dev/rest2web/r2w.py", line 171, in ? [err] count = main(config) [err] File "/home/aji/code/dev/rest2web/r2w.py", line 104, in main [err] return processor.walk() [err] File "/home/aji/code/dev/rest2web/rest2web/restprocessor.py", line 244, in walk [err] subdir=subdir) [err] File "/home/aji/code/dev/rest2web/rest2web/restprocessor.py", line 640, in process [err] copyfile(src, dest) [err] File "/usr/lib/python2.4/shutil.py", line 47, in copyfile [err] fsrc = open(src, 'rb') [err] IOError: [Errno 2] No such file or directory: 'restandmacros.txt' I have to specify the full path: file: /home/aji/www/rpinput/projects/rest2web/restandmacros.txt to get the file copied over. This happens whether the file is the page's source or not (just in case rest2web didn't like handling the same file twice). So there's a difference between the file keyword usage in the root and in subdirectories. Fuzzyman: Ok - that sounds like a bug (maybe it's a feature...). I don't *fully* understand though. Are you saying this is in the root directory, and other files specified in the same source file *work*, but this one doesn't ? How can I reproduce this bug ? Me: A file referenced in the root's index.txt, that resides in the same directory, gets copied over fine. A file referenced in a subdirectory's index.txt, that resides in that same subdirectory, generates the error *if the full path is not specified*. To answer your question specifically, all the files in the root's index.txt get copied over fine; the file in the subdirectory's index.txt does not. REPRO: I use rest2web on a Linux machine, if that makes a difference regarding paths and such. - in the site root's index.txt, add "file: fromroot.txt" to the restindex section - make a subdirectory, add a normal index.txt with a restindex section there, and add "file: fromsub.txt" to the restindex - make sure fromroot.txt and fromsub.txt exist - run r2w.py, pointing to the ini that will build the site - ??? - profit! (Sorry, wait, no, that's not right...) Let me know if you need clarifications, more repro steps (especially that "???" step, that can be a doozy), etc. Andrew Ittner |