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/branches/BRANCH_1_4_X@17177 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2007-02-13 23:20:29 +00:00
parent 65a8fdc68e
commit 96a6e50ceb
6 changed files with 44 additions and 4 deletions

View File

@ -2142,6 +2142,7 @@ lib_scripts_files = Split('''
TeXFiles.py
clean_dvi.py
convertDefault.py
date.py
fen2ascii.py
fig2pdftex.py
fig2pstex.py

View File

@ -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 \

View File

@ -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" ""

33
lib/scripts/date.py Executable file
View File

@ -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 [<format>]\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)

View File

@ -31,17 +31,19 @@
#include "support/os.h"
#include "support/package.h"
#include "support/path.h"
#include "support/std_ostream.h"
#include <boost/filesystem/operations.hpp>
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);

View File

@ -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.