Commit 41add013 authored by Martin v. Löwis's avatar Martin v. Löwis

Use hg manifest to compute list of library files to include.

parent 2318699f
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
# (C) 2003 Martin v. Loewis # (C) 2003 Martin v. Loewis
# See "FOO" in comments refers to MSDN sections with the title FOO. # See "FOO" in comments refers to MSDN sections with the title FOO.
import msilib, schema, sequence, os, glob, time, re, shutil, zipfile import msilib, schema, sequence, os, glob, time, re, shutil, zipfile
import subprocess, tempfile
from msilib import Feature, CAB, Directory, Dialog, Binary, add_data from msilib import Feature, CAB, Directory, Dialog, Binary, add_data
import uisample import uisample
from win32com.client import constants from win32com.client import constants
from distutils.spawn import find_executable from distutils.spawn import find_executable
import tempfile
# Settings can be overridden in config.py below # Settings can be overridden in config.py below
# 0 for official python.org releases # 0 for official python.org releases
...@@ -909,31 +909,27 @@ class PyDirectory(Directory): ...@@ -909,31 +909,27 @@ class PyDirectory(Directory):
kw['componentflags'] = 2 #msidbComponentAttributesOptional kw['componentflags'] = 2 #msidbComponentAttributesOptional
Directory.__init__(self, *args, **kw) Directory.__init__(self, *args, **kw)
def check_unpackaged(self): def hgmanifest():
self.unpackaged_files.discard('__pycache__') # Fetch file list from Mercurial
self.unpackaged_files.discard('.svn') process = subprocess.Popen(['hg', 'manifest'], stdout=subprocess.PIPE)
if self.unpackaged_files: stdout, stderr = process.communicate()
print "Warning: Unpackaged files in %s" % self.absolute # Create nested directories for file tree
print self.unpackaged_files result = {}
for line in stdout.splitlines():
components = line.split('/')
def inside_test(dir): d = result
if dir.physical in ('test', 'tests'): while len(components) > 1:
return True d1 = d.setdefault(components[0], {})
if dir.basedir: d = d1
return inside_test(dir.basedir) del components[0]
return False d[components[0]] = None
return result
def in_packaging_tests(dir):
if dir.physical == 'tests' and dir.basedir.physical == 'packaging':
return True
if dir.basedir:
return in_packaging_tests(dir.basedir)
return False
# See "File Table", "Component Table", "Directory Table", # See "File Table", "Component Table", "Directory Table",
# "FeatureComponents Table" # "FeatureComponents Table"
def add_files(db): def add_files(db):
hgfiles = hgmanifest()
cab = CAB("python") cab = CAB("python")
tmpfiles = [] tmpfiles = []
# Add all executables, icons, text files into the TARGETDIR component # Add all executables, icons, text files into the TARGETDIR component
...@@ -995,123 +991,40 @@ def add_files(db): ...@@ -995,123 +991,40 @@ def add_files(db):
# Add all .py files in Lib, except tkinter, test # Add all .py files in Lib, except tkinter, test
dirs = [] dirs = []
pydirs = [(root,"Lib")] pydirs = [(root, "Lib", hgfiles["Lib"], default_feature)]
while pydirs: while pydirs:
# Commit every now and then, or else installer will complain # Commit every now and then, or else installer will complain
db.Commit() db.Commit()
parent, dir = pydirs.pop() parent, dir, files, feature = pydirs.pop()
if dir == ".svn" or dir == '__pycache__' or dir.startswith("plat-"): if dir.startswith("plat-"):
continue continue
elif dir in ["tkinter", "idlelib", "Icons"]: if dir in ["tkinter", "idlelib", "turtledemo"]:
if not have_tcl: if not have_tcl:
continue continue
feature = tcltk
tcltk.set_current() tcltk.set_current()
elif dir in ('test', 'tests') or inside_test(parent): elif dir in ('test', 'tests'):
testsuite.set_current() feature = testsuite
elif not have_ctypes and dir == "ctypes": elif not have_ctypes and dir == "ctypes":
continue continue
else: feature.set_current()
default_feature.set_current()
lib = PyDirectory(db, cab, parent, dir, dir, "%s|%s" % (parent.make_short(dir), dir)) lib = PyDirectory(db, cab, parent, dir, dir, "%s|%s" % (parent.make_short(dir), dir))
# Add additional files
dirs.append(lib) dirs.append(lib)
lib.glob("*.txt") has_py = False
if dir=='site-packages': for name, subdir in files.items():
lib.add_file("README.txt", src="README") if subdir is None:
continue assert os.path.isfile(os.path.join(lib.absolute, name))
files = lib.glob("*.py") if name == 'README':
files += lib.glob("*.pyw") lib.add_file("README.txt", src="README")
if files:
# Add an entry to the RemoveFile table to remove bytecode files.
lib.remove_pyc()
# package READMEs if present
lib.glob("README")
if dir=='Lib':
lib.add_file("sysconfig.cfg")
if dir=='test' and parent.physical=='Lib':
lib.add_file("185test.db")
lib.add_file("audiotest.au")
lib.add_file("sgml_input.html")
lib.add_file("testtar.tar")
lib.add_file("test_difflib_expect.html")
lib.add_file("check_soundcard.vbs")
lib.add_file("empty.vbs")
lib.add_file("Sine-1000Hz-300ms.aif")
lib.glob("*.uue")
lib.glob("*.pem")
lib.glob("*.pck")
lib.glob("cfgparser.*")
lib.add_file("zip_cp437_header.zip")
lib.add_file("zipdir.zip")
lib.add_file("mime.types")
if dir=='capath':
lib.glob("*.0")
if dir=='tests' and parent.physical=='distutils':
lib.add_file("Setup.sample")
if dir=='decimaltestdata':
lib.glob("*.decTest")
if dir=='xmltestdata':
lib.glob("*.xml")
lib.add_file("test.xml.out")
if dir=='output':
lib.glob("test_*")
if dir=='sndhdrdata':
lib.glob("sndhdr.*")
if dir=='idlelib':
lib.glob("*.def")
lib.add_file("idle.bat")
lib.add_file("ChangeLog")
if dir=="Icons":
lib.glob("*.gif")
lib.add_file("idle.icns")
if dir=="command" and parent.physical in ("distutils", "packaging"):
lib.glob("wininst*.exe")
lib.add_file("command_template")
if dir=="lib2to3":
lib.removefile("pickle", "*.pickle")
if dir=="macholib":
lib.add_file("README.ctypes")
lib.glob("fetch_macholib*")
if dir=='turtledemo':
lib.add_file("turtle.cfg")
if dir=="pydoc_data":
lib.add_file("_pydoc.css")
if dir.endswith('.dist-info'):
lib.add_file('INSTALLER')
lib.add_file('REQUESTED')
lib.add_file('RECORD')
lib.add_file('METADATA')
lib.glob('RESOURCES')
if dir.endswith('.egg-info') or dir == 'EGG-INFO':
lib.add_file('PKG-INFO')
if in_packaging_tests(parent):
lib.glob('*.html')
lib.glob('*.tar.gz')
if dir=='fake_dists':
# cannot use glob since there are also egg-info directories here
lib.add_file('cheese-2.0.2.egg-info')
lib.add_file('nut-funkyversion.egg-info')
lib.add_file('strawberry-0.6.egg')
lib.add_file('truffles-5.0.egg-info')
lib.add_file('babar.cfg')
lib.add_file('babar.png')
if dir=="data" and parent.physical=="test_email":
# This should contain all non-.svn files listed in subversion
for f in os.listdir(lib.absolute):
if f.endswith(".txt") or f==".svn":continue
if f.endswith(".au") or f.endswith(".gif"):
lib.add_file(f)
else: else:
print("WARNING: New file %s in test/test_email/data" % f) lib.add_file(name)
if dir=='tests' and parent.physical == 'packaging': has_py = has_py or name.endswith(".py") or name.endswith(".pyw")
lib.add_file('SETUPTOOLS-PKG-INFO2') else:
lib.add_file('SETUPTOOLS-PKG-INFO') assert os.path.isdir(os.path.join(lib.absolute, name))
lib.add_file('PKG-INFO') pydirs.append((lib, name, subdir, feature))
for f in os.listdir(lib.absolute):
if os.path.isdir(os.path.join(lib.absolute, f)): if has_py:
pydirs.append((lib, f)) lib.remove_pyc()
for d in dirs:
d.check_unpackaged()
# Add DLLs # Add DLLs
default_feature.set_current() default_feature.set_current()
lib = DLLs lib = DLLs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment