[Distutils] Synchronizing version information

Bastian Kleineidam calvin@cs.uni-sb.de
Wed Sep 20 06:44:01 2000


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--1619418364-707833344-969446609=:31224
Content-Type: TEXT/PLAIN; charset=US-ASCII

>Is there any mechanism in distutils to facilitate such synchronization?
You could use the attached Template.py file.
Then copy __init__.py to __init__.py.tmpl, insert $version and execute
t = Template.Template('__init__.py.tmpl')
f = open('__init__.py','w')
f.write(t.fill_in({'version', 0.1})
f.close

and $version gets replaced.

Bastian

--1619418364-707833344-969446609=:31224
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="Template.py"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.21.0009201243290.31224@earth.cs.uni-sb.de>
Content-Description: 
Content-Disposition: attachment; filename="Template.py"

IiIiU3RyaW5nIGludGVycG9sYXRpb24NCjIwIE9jdCAxOTk2DQogICAgSW5p
dGlhbCB2ZXJzaW9uIGNhbGxlZCBJdHBsIGJ5IEthLVBpbmcgWWVlDQoxMyBK
YW4gMjAwMA0KICAgIE1vZGlmaWVkIGJ5IEJhc3RpYW4gS2xlaW5laWRhbSB0
byBlbXVsYXRlIFBlcmxzIFRleHQ6OlRlbXBsYXRlDQogICANClVzYWdlOg0K
VGVtcGxhdGUgZGF0YSBjb25zaXN0cyBvZiBub3JtYWwgdGV4dCBhbmQgcHl0
aG9uIGNvZGUgZnJhZ21lbnRzLg0KQ29kZSBmcmFnbWVudHMgc3RhcnQgd2l0
aCBhIGRvbGxhciBzaWduIGZvbGxvd2VkIGVpdGhlciBieQ0KMSkgdmFyaWFi
bGUgb3IgYXR0cmlidXRlIHJlZmVyZW5jZSBvciBzdWJzY3JpcHRpb24gb3Ig
ZnVuY3Rpb24gY2FsbA0KICAgZXZhbHVhdGVzIHRvIHRoZSBzdHIoKSB2YWx1
ZSBvZiB0aGUgZ2l2ZW4gZXhwcmVzc2lvb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pbiBzZWxmLmRhdGEiDQog
ICAgICAgIGlmIGFyZ3R5cGUgPT0gRklMRU5BTUU6DQogICAgICAgICAgICBm
aWxlID0gb3BlbihkYXRhKQ0KICAgICAgICAgICAgc2VsZi5kYXRhID0gc3Ry
aW5nLmpvaW4oZmlsZS5yZWFkbGluZXMoKSwgIiIpDQogICAgICAgICAgICBm
aWxlLmNsb3NlKCkNCiAgICAgICAgZWxpZiBhcmd0eXBlID09IEZJTEU6DQog
ICAgICAgICAgICBpZiBkYXRhLmNsb3NlZDoNCiAgICAgICAgICAgICAgICB3
YXNjbG9zZWQgPSAxDQogICAgICAgICAgICAgICAgb3BlbihkYXRhKQ0KICAg
ICAgICAgICAgZWxzZToNCiAgICAgICAgICAgICAgICB3YXNjbG9zZWQgPSAw
DQogICAgICAgICAgICBzZWxmLmRhdGEgPSBzdHJpbmcuam9pbihkYXRhLnJl
YWRsaW5lcygpLCAiIikNCiAgICAgICAgICAgIGlmIHdhc2Nsb3NlZDoNCiAg
ICAgICAgICAgICAgICBkYXRhLmNsb3NlKCkNCiAgICAgICAgZWxpZiBhcmd0
eXBlID09IEFSUkFZOg0KICAgICAgICAgICAgc2VsZi5kYXRhID0gc3RyaW5n
LmpvaW4oZGF0YSwgIlxuIikNCiAgICAgICAgZWxzZToNCiAgICAgICAgICAg
IHNlbGYuZGF0YSA9IGRhdGENCiAgICAgICAgaWYgdHlwZShzZWxmLmRhdGEp
ICE9IFN0cmluZ1R5cGU6DQogICAgICAgICAgICByYWlzZSBUZW1wbGF0ZUVy
cm9yLCAiY291bGQgbm90IHJlYWQgZGF0YSINCg0KDQogICAgZGVmIGZpbGxf
aW4oc2VsZiwgZGljdD17fSk6DQogICAgICAgICJwYXJzZSB0aGUgdGVtcGxh
dGUgYW5kIGZpbGwgaW4gdmFsdWVzIg0KICAgICAgICB0cnk6DQogICAgICAg
ICAgICBuYW1lY2hhcnMgPSAnYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXon
IFwNCiAgICAgICAgICAgICAgICAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldY
WVowMTIzNDU2Nzg5Xyc7DQogICAgICAgICAgICBvdXQgPSAiIg0KICAgICAg
ICAgICAgcG9zID0gMA0KICAgICAgICAgICAgd2hpbGUgcG9zIDwgbGVuKHNl
bGYuZGF0YSkgYW5kIFwNCiAgICAgICAgICAgICAgICAgIHN0cmluZy5maW5k
KHNlbGYuZGF0YSwgIiQiLCBwb3MpICE9IC0xOg0KICAgICAgICAgICAgICAg
IGRvbGxhciA9IHN0cmluZy5maW5kKHNlbGYuZGF0YSwgIiQiLCBwb3MpDQog
ICAgICAgICAgICAgICAgIyBhcHBlbmQgcHVyZSB0ZXh0IHdpdGhvdXQgZG9s
bGFyDQogICAgICAgICAgICAgICAgb3V0ID0gb3V0ICsgc2VsZi5kYXRhW3Bv
czpkb2xsYXJdDQogICAgICAgICAgICAgICAgcG9zID0gZG9sbGFyICsgMQ0K
ICAgICAgICAgICAgICAgIG5leHRjaGFyID0gc2VsZi5kYXRhW2RvbGxhcisx
XQ0KDQogICAgICAgICAgICAgICAgaWYgbmV4dGNoYXIgPT0gJ3snOg0KICAg
ICAgICAgICAgICAgICAgICAjIGFwcGx5IGEgY29kZSBmcmFnbWVudA0KICAg
ICAgICAgICAgICAgICAgICBsZXZlbCA9IDENCiAgICAgICAgICAgICAgICAg
ICAgd2hpbGUgbGV2ZWw6DQogICAgICAgICAgICAgICAgICAgICAgICBwb3Mg
PSBwb3MgKyAxDQogICAgICAgICAgICAgICAgICAgICAgICBpZiBzZWxmLmRh
dGFbcG9zXSA9PSAieyI6DQogICAgICAgICAgICAgICAgICAgICAgICAgICAg
bGV2ZWwgPSBsZXZlbCArIDENCiAgICAgICAgICAgICAgICAgICAgICAgIGVs
aWYgc2VsZi5kYXRhW3Bvc10gPT0gIn0iOg0KICAgICAgICAgICAgICAgICAg
ICAgICAgICAgIGxldmVsID0gbGV2ZWwgLSAxDQogICAgICAgICAgICAgICAg
ICAgIG91dHB1dCA9IFtdDQogICAgICAgICAgICAgICAgICAgIGV4ZWMgc2Vs
Zi5kYXRhWyhkb2xsYXIrMik6cG9zXSBpbiBkaWN0LCB7Im91dHB1dCI6b3V0
cHV0fQ0KICAgICAgICAgICAgICAgICAgICBmb3Igb2JqIGluIG91dHB1dDoN
CiAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9IG91dCArIG9iag0KICAg
ICAgICAgICAgICAgICAgICBwb3MgPSBwb3MgKyAxDQoNCiAgICAgICAgICAg
ICAgICBlbGlmIG5leHRjaGFyIGluIG5hbWVjaGFyczoNCiAgICAgICAgICAg
ICAgICAgICAgIyBzY2FuIGEgdmFyaWFibGUgYWNjZXNzDQogICAgICAgICAg
ICAgICAgICAgIHZhciA9IHJlZ2V4dmFyLm1hdGNoKHNlbGYuZGF0YVtwb3M6
XSkNCiAgICAgICAgICAgICAgICAgICAgaWYgdmFyOg0KICAgICAgICAgICAg
ICAgICAgICAgICAgIyBIb3VzdG9uLCB3ZSBoYXZlIGEgbWF0Y2ghDQogICAg
ICAgICAgICAgICAgICAgICAgICAjIGV4dHJhY3QgdGhlIHN0cmluZyBhbmQg
ZXZhbHVhdGUgaXQNCiAgICAgICAgICAgICAgICAgICAgICAgIHZhciA9IHZh
ci5ncm91cCgpDQogICAgICAgICAgICAgICAgICAgICAgICBwb3MgPSBwb3Mg
KyBsZW4odmFyKQ0KICAgICAgICAgICAgICAgICAgICAgICAgb3V0ID0gb3V0
ICsgc3RyKGV2YWwodmFyLCBkaWN0KSkNCiAgICAgICAgICAgICAgICBlbHNl
Og0KICAgICAgICAgICAgICAgICAgICBpZiBuZXh0Y2hhciA9PSAiJCI6DQog
ICAgICAgICAgICAgICAgICAgICAgICBwb3MgPSBwb3MgKyAxDQogICAgICAg
ICAgICAgICAgICAgICAgICBvdXQgPSBvdXQgKyAiJCINCg0KICAgICAgICAg
ICAgaWYgcG9zIDwgbGVuKHNlbGYuZGF0YSk6IA0KICAgICAgICAgICAgICAg
IG91dCA9IG91dCArIHNlbGYuZGF0YVtwb3M6XQ0KICAgICAgICBleGNlcHQ6
DQogICAgICAgICAgICBzeXMuc3RkZXJyLndyaXRlKCJUZW1wbGF0ZS5weTog
cGFyc2UgZXJyb3IgYXQgcG9zICIrYHBvc2ArIjpcbiIrXA0KICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICBvdXQrIlxuIikNCg0KICAgICAgICByZXR1
cm4gb3V0DQoNCg==
--1619418364-707833344-969446609=:31224--