gnulib-tool-py
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnulib-tool-py] comments


From: Bruno Haible
Subject: [gnulib-tool-py] comments
Date: Sun, 29 Apr 2012 23:52:20 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Hi Dmitriy,

While looking at the process spawning code, I see this code in method
GNULibInfo.date:

      args = ['git', 'log', FILES['changelog']]
      proc1 = sp.Popen(args,stdout=sp.PIPE)
      proc2 = sp.Popen(['head'],
        stdin=proc1.stdout, stdout=sp.PIPE)
      proc1.stdout.close()
      while counter <= 2:
        result += proc2.stdout.readline()
        counter += 1
      pattern = re.compile('Date:[\t ]*(.*?)\n')
      result = pattern.findall(result)[0]
      pattern = re.compile('^[^ ]* ([^ ]*) ([0-9]*) ([0-9:]*) ([0-9]*) ')
      result = pattern.sub('\\1 \\2 \\4 \\3 ', result)
      args = ['date', '-d', result, '-u', '+%Y-%m-%d %H:%M:%S']
      proc = sp.check_output(args)
      result = str(proc)

The original code had a couple of comments:

    sed_extract_first_date='/^Date/{
s/^Date:[        ]*//p
q
}'
    date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e 
"$sed_extract_first_date"`
    # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600".
    sed_year_before_time='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) 
/\1 \2 \4 \3 /'
    date=`echo "$date" | sed -e "$sed_year_before_time"`
    # Use GNU date to compute the time in GMT.
    date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"`
    version=' '`cd "$gnulib_dir" && ./build-aux/git-version-gen /dev/null | sed 
-e 's/-dirty/-modified/'`

I think without these two comment lines, it is impossible to understand
what the code is trying to do. Could you please keep these comments in
the rewrite?

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]