diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index 40975c4f1b..9bba189f3d 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -2142,6 +2142,7 @@ lib_scripts_files = Split(''' TeXFiles.py clean_dvi.py convertDefault.py + date.py fen2ascii.py fig2pdftex.py fig2pstex.py diff --git a/lib/Makefile.am b/lib/Makefile.am index b6435d7a24..cc599f9061 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -920,6 +920,7 @@ dist_scripts_PYTHON = \ scripts/TeXFiles.py \ scripts/clean_dvi.py \ scripts/convertDefault.py \ + scripts/date.py \ scripts/fen2ascii.py \ scripts/fig2pdftex.py \ scripts/fig2pstex.py \ diff --git a/lib/configure.py b/lib/configure.py index f292567266..5ee827c275 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -438,7 +438,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..0228bc0a75 --- /dev/null +++ b/lib/scripts/date.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# -*- coding: iso-8859-1 -*- + +# 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 93b7f9f212..8ed977b6d5 100644 --- a/src/insets/ExternalSupport.C +++ b/src/insets/ExternalSupport.C @@ -31,17 +31,19 @@ #include "support/os.h" #include "support/package.h" #include "support/path.h" - #include "support/std_ostream.h" +#include + namespace support = lyx::support; using std::endl; - using std::ostream; using std::string; using std::vector; +using boost::filesystem::is_directory; + namespace lyx { namespace external { @@ -254,7 +256,7 @@ void updateExternal(InsetExternalParams const & params, string const temp_file = support::MakeAbsPath(params.filename.mangledFilename(), m_buffer->temppath()); - if (!abs_from_file.empty()) { + if (!abs_from_file.empty() && !is_directory(abs_from_file)) { unsigned long const from_checksum = support::sum(abs_from_file); unsigned long const temp_checksum = support::sum(temp_file); diff --git a/status.14x b/status.14x index 0f51944bef..2667aac848 100644 --- a/status.14x +++ b/status.14x @@ -237,6 +237,9 @@ What's new - add Aspell/Pspell's file extension for personal dictionary files in preferences (bug 895) +- Fix hang/crash on Windows/Cygwin when using the external date inset + (bug 3220). + * BUILD/INSTALLATION: - Allow autoconf 2.60 and 2.61 for building.