Re: [Tutor] Embedding strings in a python script

2007-01-04 Thread Kent Johnson
Tony Cappellini wrote:
> What I'd like to know, is there a way I can embed/endcode the cvs string 
> above in the python script, so that when that script is modified and 
> checked into cvs, that the cvs header string above will not be modified 
> by cvs?

Try using \x24 instead of $:

cvs_header='''
###
#
# \x24Header:\x24
#
# \x24Revision:\x24
# \x24Author:\x24
# \x24Date:\x24
#

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Embedding strings in a python script

2007-01-03 Thread Tony Cappellini

Message: 5
Date: Thu, 4 Jan 2007 16:13:51 +1300
From: "John Fouhy" <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Embedding strings in a python script
To: tutor-python 
Message-ID:
  <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 04/01/07, Tony Cappellini <[EMAIL PROTECTED]> wrote:

What I'd like to know, is there a way I can embed/endcode the cvs string
above in the python script, so that when that script is modified and

checked

into cvs, that the cvs header string above will not be modified by cvs?


What about this:

cvs_header='''
###
#
# @Header:@

I will give that a try. I don't know if cvs keys off of the word, the $, or
the word surround by any two symbols.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Embedding strings in a python script

2007-01-03 Thread John Fouhy
On 04/01/07, Tony Cappellini <[EMAIL PROTECTED]> wrote:
> What I'd like to know, is there a way I can embed/endcode the cvs string
> above in the python script, so that when that script is modified and checked
> into cvs, that the cvs header string above will not be modified by cvs?

What about this:

cvs_header='''
###
#
# @Header:@
#
# @Revision:@
# @Author:@
# @Date:@
#
'''.replace('@', '$')

?

-- 
John.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Embedding strings in a python script

2007-01-03 Thread Tony Cappellini

I have a number of text files which need to be checked into CVS.
Each file needs a special text header/footer in order that CVS can track
changes and version numbers.

Python to the rescue.

I've written a small python program which will write the header/footer to
all files in the current directory.

In order to do this, I need to add this string in my python program.

cvs_header='''
###
#
# $Header:$
#
# $Revision:$
# $Author:$
# $Date:$
#
'''

It works just fine.


However, the program which I wrote also needs to be kept under version
control.
When I make changes to that program, I noticed that the header above gets
modified by cvs, because it contains key variables which are recognized by
cvs.

This is unacceptable.

So I took this string out of my program, wrote it to a pickle file, and now
the pickle file is read at runtime, and the program will write the empty
header to the target files.
I can check the pickle files into cvs as binary files, and the header
strings will not be modified.

I now have 3 pickle files I need to distribute with the program, which is a
minor nuisance. Even using py2exe on Windows, these 3 files cannot be
embedded within the exe itself.

What I'd like to know, is there a way I can embed/endcode the cvs string
above in the python script, so that when that script is modified and checked
into cvs, that the cvs header string above will not be modified by cvs?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor