From 1b217435117c5b1126f6961f4e4715b8f5095eee Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Tue, 13 Feb 2007 19:09:54 +0000 Subject: [PATCH] Fix bug 3220 * src/insets/ExternalSupport.C (updateExternal): Avoid computing crc of a directory as this leads to a crash on Cygwin. * lib/configure.py: Use a python script to get the current date in order to avoid a stalling condition with the date command on Win32. * lib/scripts/date.py: New python script. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17168 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/configure.py | 2 +- lib/scripts/date.py | 33 +++++++++++++++++++++++++++++++++ src/insets/ExternalSupport.C | 6 +++++- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100755 lib/scripts/date.py diff --git a/lib/configure.py b/lib/configure.py index f082922a63..8ae35687b7 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -451,7 +451,7 @@ def checkConverterEntries(): # # Entried that do not need checkProg addToRC(r'''\converter lyxpreview ppm "python -tt $$s/scripts/lyxpreview2bitmap.py" "" -\converter date dateout "date +%d-%m-%Y > $$o" "" +\converter date dateout "python -tt $$s/scripts/date.py %d-%m-%Y > $$o" "" \converter docbook docbook-xml "cp $$i $$o" "xml" \converter fen asciichess "python -tt $$s/scripts/fen2ascii.py $$i $$o" "" \converter fig pdftex "python -tt $$s/scripts/fig2pdftex.py $$i $$o" "" diff --git a/lib/scripts/date.py b/lib/scripts/date.py new file mode 100755 index 0000000000..23cd79e943 --- /dev/null +++ b/lib/scripts/date.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# file date.py +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. + +# \author Enrico Forestieri + +# Full author contact details are available in file CREDITS. + +# Print the system date and time in the given format. See the python +# documentation for available formats (mostly the same as the POSIX std). +# This file is provided because the date command on Windows is not +# POSIX compliant. + +import sys +from time import strftime + +def main(argv): + if len(argv) > 2: + sys.stderr.write('Usage: python date.py []\n') + sys.exit(1) + + if len(argv) == 2: + format = argv[1] + else: + format = "%d-%m-%Y" + + print strftime(format) + +if __name__ == "__main__": + main(sys.argv) diff --git a/src/insets/ExternalSupport.C b/src/insets/ExternalSupport.C index d84baf7506..133eec4138 100644 --- a/src/insets/ExternalSupport.C +++ b/src/insets/ExternalSupport.C @@ -31,10 +31,14 @@ #include "support/os.h" #include "support/package.h" +#include + using std::endl; using std::string; using std::vector; +using boost::filesystem::is_directory; + namespace lyx { @@ -247,7 +251,7 @@ void updateExternal(InsetExternalParams const & params, FileName const temp_file( support::makeAbsPath(params.filename.mangledFilename(), m_buffer->temppath())); - if (!params.filename.empty()) { + if (!params.filename.empty() && !is_directory(params.filename.toFilesystemEncoding())) { unsigned long const from_checksum = support::sum(params.filename); unsigned long const temp_checksum = support::sum(temp_file); -- 2.39.5