[Distutils] Comments on Distutils-0.1.2 on Windows
Thomas Heller
thomas.heller@ion-tof.com
Wed, 12 Jan 2000 16:57:16 +0100
Well, I finally got a chance to test distutils 0.1.2 under Windows.
1. There is no standard zip-utility under windows,
but zip.exe from info-zip works right out of the box.
I've fixed the source to use James C. Ahlstrom's zipfile.py
when zip.exe is not available (Should this always be used?)
class Dist (Command):
...
def make_zipfile (self, base_dir):
# This assumes the Unix 'zip' utility -- it could be easily recast
# to use pkzip (or whatever the command-line zip creation utility
# on Redmond's archaic CP/M knockoff is nowadays), but I'll let
# someone who can actually test it do that.
try:
self.spawn (["zip", "-r", base_dir + ".zip", base_dir])
except OSError:
import zipfile
z = zipfile.ZipFile (base_dir + ".zip", "wb",
compression=zipfile.ZIP_DEFLATED)
def visit (z, dirname, names):
for name in names:
path = os.path.join (dirname, name)
if os.path.isfile (path):
z.write (path, path)
os.path.walk (base_dir, visit, z)
z.close()
2. Libraries for VC++ are named python15.lib,
not libpython15.lib. I had to fix this in msvccompiler.py:
class MSVCCompiler (CCompiler):
...
def library_filename (self, libname):
"""Return the static library filename corresponding to the
specified library name."""
# return "lib%s%s" %( libname, self._static_lib_ext )
return "%s%s" %( libname, self._static_lib_ext )
def shared_library_filename (self, libname):
"""Return the shared library filename corresponding to the
specified library name."""
# return "lib%s%s" %( libname, self._shared_lib_ext )
return "%s%s" %( libname, self._shared_lib_ext )
3. os.link does not exist under windows, use shutil.copyfile
for that:
class Dist (Command):
def make_release_tree (self, base_dir, files):
...
self.announce ("making hard links in %s..." % base_dir)
for file in files:
dest = os.path.join (base_dir, file)
if not os.path.exists (dest):
try:
self.execute (os.link, (file, dest),
"linking %s -> %s" % (file, dest))
except AttributeError:
import shutil
self.execute (shutil.copyfile, (file, dest),
"copying %s -> %s" % (file, dest))
Regards
Thomas Heller
ION-TOF GmbH