[Python-Dev] Can't build Zope on Windows w/ 2.4.1c1

Tim Peters tim.peters at gmail.com
Thu Mar 10 18:46:23 CET 2005


This is going to need someone who understands distutils internals. 
The strings we end up passing to putenv() grow absurdly large, and
sooner or later Windows gets very unhappy with them.

os.py has a

    elif name in ('os2', 'nt'):  # Where Env Var Names Must Be UPPERCASE

class controlling introduction of a _Environ class.  I changed its
__setitem__ like so:

            def __setitem__(self, key, item):
                if key.upper() == "PATH":           # new line
                    print "len(item)", len(item)       # new line
                putenv(key, item)
                self.data[key.upper()] = item

As "setup.py build_ext -i" goes on while compiling Zope, this is the
output before putenv barfs:

len(item) 1025
len(item) 1680
len(item) 2335
len(item) 2990
len(item) 3645
len(item) 4300
len(item) 4955
len(item) 5610
len(item) 6265
len(item) 6920
len(item) 7575
len(item) 8230
len(item) 8885
len(item) 9540
len(item) 10195
len(item) 10850
len(item) 11505
len(item) 12160
len(item) 12815
len(item) 13470
len(item) 14125
len(item) 14780
len(item) 15435
len(item) 16090
len(item) 16745
len(item) 17400
len(item) 18055
len(item) 18710
len(item) 19365
len(item) 20020
len(item) 20675
len(item) 21330
len(item) 21985
len(item) 22640
len(item) 23295
len(item) 23950
len(item) 24605
len(item) 25260
len(item) 25915
len(item) 26570
len(item) 27225
len(item) 27880
len(item) 28535
len(item) 29190
len(item) 29845
len(item) 30500
len(item) 31155
len(item) 31810
len(item) 32465

The PATH isn't gibberish at this point -- it just keeps adding the
MSVC directories (like

     C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\bin

) again and again and again.  I don't know what the environ limits are
on various flavors of Windows; empirically, on my Win XP Pro SP2 box,
the values have to be < 32K or putenv() dies.  But there's surely no
need for distutils to make PATH grow without bound, so I think this is
a distutils bug.

A workaround for building Zope is easy but embarrassing <wink>:  kill
setup.py before it hits this error, then start it again.  Lather,
rinse, repeat.  After a few iterations, everything builds fine.


More information about the Python-Dev mailing list