ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wybo Dekker <wybo@servalys.nl>
Cc: Tobias Burnus <burnus@gmx.de>, <ntg-context@ntg.nl>
Subject: Re: getting context's version
Date: Wed, 18 Sep 2002 17:28:13 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.42.0209181351080.7905-100000@servalys.nl> (raw)
In-Reply-To: <20020918114734.404ff990.taco@elvenkind.com>

On Wed, 18 Sep 2002, Taco Hoekwater wrote:

> Surely that's the file date of the format file?
>
> stat (`kpsewhich cont-en.efmt`)

No, you can create a very new format file from a very old context version

> perl doesnt care about that binary stuff :)
>
>    /\(format=cont-.. (\d+).(\d+).(\d+)\)/;

I tried that one already, but what you get is the file date, not the
context version. The latter isn't in the format, unless in binary maybe.

I think I need the following routine (yes, it's much more than 4 lines):

#!/usr/bin/perl -w

sub test_context_version {
    my $required=shift;
    chomp (my $fmt=`kpsewhich cont-en.efmt`);
    chomp (my $tex=`kpsewhich context.tex`);
    (stat $fmt)[10] < (stat $tex)[10] and
        die "Your context formats need (re)generation:\n";
    open(IN,$tex) or do {
        warn "can't find context.tex";
        return 1;
    };
    while(<IN>) {
        if ( /contextversion\{(\d+)\.(\d+)\.(\d+)\}/ ) {
            my $have;
            $have=sprintf('%4d%02d%02d',$1,$2,$3);
            $have < $required and
                warn "Your ConTeXt is too old ($have); you need $required\n";
            return 1;
            last;
        }
    }
    return 0;
}

for $v (20020701,20020901) {
    warn "testing $v:\n";
    test_context_version($v);
}

-- 
Wybo


  reply	other threads:[~2002-09-18 15:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-17 10:07 Wybo Dekker
2002-09-17 18:00 ` Tobias Burnus
2002-09-17 18:23   ` Wybo Dekker
2002-09-18  6:57     ` Hans Hagen
2002-09-18  8:41       ` Tobias Burnus
2002-09-18  8:59       ` Wybo Dekker
2002-09-18  9:17         ` Tobias Burnus
2002-09-18  9:47           ` Taco Hoekwater
2002-09-18 15:28             ` Wybo Dekker [this message]
2002-09-19 18:41               ` Simon Pepping
2002-09-20  8:06                 ` Taco Hoekwater
2002-05-20  8:56                   ` Hans Hagen
2002-09-20  9:32                     ` Tobias Burnus
2002-05-20 14:42                       ` Hans Hagen
2002-09-20 17:55                         ` Henning Hraban Ramm
2002-09-21 17:29                       ` Simon Pepping
2002-09-18  9:43         ` Taco Hoekwater
2002-09-17 18:28 ` Taco
2002-09-17 21:20   ` Wybo Dekker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.42.0209181351080.7905-100000@servalys.nl \
    --to=wybo@servalys.nl \
    --cc=burnus@gmx.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).