Commit 2b5e19c5 authored by Sidnei da Silva's avatar Sidnei da Silva

- Update the Windows makefile to have the same features as the non-Windows one.

- Use a copy instead of symlink in setup.py for the special headers.
parent bedd9853
......@@ -104,6 +104,7 @@ uninstance:
clean: unbuild
${FIND} "${BASE_DIR}" \
-name '*.py[co]' -o -name '*.so' -o -name '*.o' | ${XARGS} ${RM}
${RM} "$(BASE_DIR)/lib/python/version.txt"
${RMRF} build
# version_txt: create a version file in lib/python/version.txt
......
......@@ -10,14 +10,17 @@ RELEASE_TAG=<<VERSION_RELEASE_TAG>>
PACKAGE_NAME=$(NAME)-$(MAJOR_VERSION).$(MINOR_VERSION)-$(RELEASE_TAG)
PYTHON="<<PYTHON>>"
ZPKG=zpkg
TMPDIR="<<TMP_DIR>>"
PREFIX="<<PREFIX>>"
BASE_DIR="<<BASE_DIR>>"
BASE_DIR=<<BASE_DIR>>
BUILD_BASE=<<BUILD_BASE>>
DISTUTILS_OPTS=<<DISTUTILS_OPTS>>
INSTALL_FLAGS=<<INSTALL_FLAGS>>
TESTOPTS=-v
BUILD_FLAGS=-i
BUILD_FLAGS=--build-base="$(BUILD_BASE)" \
--build-lib="$(BUILD_BASE)\build-lib" \
--build-scripts="$(BUILD_BASE)\build-scripts"\
--build-temp="$(BUILD_BASE)\build-temp"
RM=del /f /q
!IF ("$(OS)" == "Windows_NT")
......@@ -28,6 +31,7 @@ RMRF=deltree /y
CD=cd
XCOPY=xcopy /i /s /e /y
COPY=copy
EXISTS=IF EXIST
default: build
# default: The default step (invoked when make is called without a target)
......@@ -35,25 +39,29 @@ default: build
@ echo Zope built. Next, do 'nmake install'.
@ echo.
.PHONY : clean install instance untestinst testinst build
.PHONY : clean install instance untestinst testinst build unbuild
.PHONY : default
# build: Do whatever 'setup.py build' implies
build:
$(PYTHON) "$(BASE_DIR)\setup.py" \
$(DISTUTILS_OPTS) build_ext $(BUILD_FLAGS)
$(DISTUTILS_OPTS) build $(BUILD_FLAGS)
# unbuild: Remove the build directory (undo the make build step)
unbuild:
-$(EXISTS) $(BUILD_BASE) $(RMRF) $(BUILD_BASE)
# install: Install a software home.
install: build version_txt
$(PYTHON) "$(BASE_DIR)\setup.py" $(DISTUTILS_OPTS) \
build_ext $(BUILD_FLAGS) \
install --home="$(PREFIX)" $(INSTALL_FLAGS)
$(PYTHON) "$(BASE_DIR)\setup.py" $(DISTUTILS_OPTS) install \
--prefix="$(PREFIX)" $(BUILD_FLAGS) $(INSTALL_FLAGS)
@ echo.
@ echo Zope binaries installed successfully.
@ echo Now run '$(PYTHON) $(PREFIX)\bin\mkzopeinstance.py'
# inplace: Do an in-place build
inplace: build
inplace:
$(MAKE) install PREFIX="$(BASE_DIR)"
# test: Do an inplace build and run the Zope test suite.
test: inplace
......@@ -67,42 +75,48 @@ instance: build
# testinst: Perform an inplace build and create an instance home in the
# resulting software home without asking questions. Useful when
# performing automated testing.
# testinst: MKZ_FLAGS=--user=admin:admin --dir="$(BASE_DIR)"
# testinst: instance
testinst:
$(MAKE) instance MKZ_FLAGS=--user=admin:admin --dir="$(BASE_DIR)"
# uninstance: Remove the instance files made by testinstance (w/ prejudice)
uninstance:
$(RMRF) "$(BASE_DIR)/bin"
$(RMRF) "$(BASE_DIR)/etc"
$(RMRF) "$(BASE_DIR)/import"
$(RMRF) "$(BASE_DIR)/log"
$(RMRF) "$(BASE_DIR)/var"
$(RMRF) "$(BASE_DIR)/Products"
$(EXISTS) "$(BASE_DIR)/bin" $(RMRF) "$(BASE_DIR)/bin"
$(EXISTS) "$(BASE_DIR)/etc" $(RMRF) "$(BASE_DIR)/etc"
$(EXISTS) "$(BASE_DIR)/import" $(RMRF) "$(BASE_DIR)/import"
$(EXISTS) "$(BASE_DIR)/log" $(RMRF) "$(BASE_DIR)/log"
$(EXISTS) "$(BASE_DIR)/var" $(RMRF) "$(BASE_DIR)/var"
$(EXISTS) "$(BASE_DIR)/Products" $(RMRF) "$(BASE_DIR)/Products"
# clean: Delete the build files and any binaries/bytecode files in
# the source directory for good measure.
clean:
$(CD) "$(BASE_DIR)"
-$(RM) /s *.pyc *.pyo *.dll *.o *.obj *.pyd
-$(RM) "$(BASE_DIR)\lib\python\version.txt"
-$(RMRF) build
-$(EXISTS) "$(BASE_DIR)\lib\python\version.txt" $(RM) "$(BASE_DIR)\lib\python\version.txt"
-$(EXISTS) build $(RMRF) build
# version_txt: create a version file in lib/python/version.txt
version_txt:
echo Zope $(MAJOR_VERSION).$(MINOR_VERSION)-$(RELEASE_TAG) >\
"$(BASE_DIR)/lib/python/version.txt"
# Building a source distribution requires that zpkg be available:
sdist: version_txt
$(ZPKG) -C $(BASE_DIR)\releases\Zope2.cfg -r $(MAJOR_VERSION).$(MINOR_VERSION)$(RELEASE_TAG)
# sdist: Create a source distribution file (implies clobber).
#
sdist: clobber sdist_tgz
# sdist_tgz: Create a tgz archive file as a source distribution.
#
sdist_tgz: version_txt
$(PYTHON) $(BASE_DIR)\inst\tar.py $(BASE_DIR)\$(PACKAGE_NAME).tgz $(BASE_DIR)
# clobber: Make the source tree 'pristine' again.
clobber: clean uninstance
# distclean: Make the source tree *really* 'pristine' again.
distclean: clobber
$(RM) makefile Makefile
$(RMRF) build-base
$(EXISTS) makefile $(RM) makefile
$(EXISTS) Makefile $(RM) Makefile
$(EXISTS) build-base $(RMRF) build-base
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
import os
import sys
import optparse
import tarfile
from distutils import filelist
INCLUDES = tuple('.*'.split())
EXCLUDES = tuple(r""".*.svn\\ .*CVS\\ .*.tgz
.*makefile .*Makefile inst\\tmp\\.* .*build-base\\
.*~ .*.#.*""".split())
def collect(top_dir, includes=INCLUDES, excludes=EXCLUDES):
old_dir = os.getcwd()
os.chdir(top_dir)
try:
fl = filelist.FileList()
fl.findall()
for inc in includes:
fl.include_pattern(inc, is_regex=1)
for exc in excludes:
fl.exclude_pattern(exc, is_regex=1)
return fl.files
finally:
os.chdir(old_dir)
def tar_it_up(dest, files):
tar = tarfile.open(dest, mode='w:gz')
for fname in files:
tar.add(fname, recursive=False)
tar.close()
def main(options, args):
dest, top_dir = args
includes = options.include
excludes = options.exclude
excludes.append('.*%s.*' % os.path.basename(dest))
files = collect(top_dir, includes=includes, excludes=excludes)
tar_it_up(dest, files)
if __name__ == '__main__':
excludes = list(EXCLUDES)
includes = list(INCLUDES)
parser = optparse.OptionParser()
parser.add_option('', '--exclude', action='append', default=excludes)
parser.add_option('', '--include', action='append', default=includes)
options, args = parser.parse_args()
if not len(args) == 2:
parser.print_help()
parser.exit(status=1)
main(options, args)
ZOPE_MAJOR_VERSION = '2.9'
ZOPE_MINOR_VERSION = '3'
ZOPE_MINOR_VERSION = '4'
ZOPE_BRANCH_NAME = '$Name$'[6:] or 'no-branch'
# always start prerelease branches with '0' to avoid upgrade
# issues in RPMs
VERSION_RELEASE_TAG = ''
VERSION_RELEASE_TAG = 'alpha'
......@@ -34,11 +34,11 @@ Distutils setup for Zope
--install-platlib=/usr/local/lib/zope \
--install-purelib=/usr/local/lib/zope
"""
ZOPE_VERSION = '2.9.4-alpha'
import glob
import os
import sys
import shutil
import distutils.core
......@@ -49,6 +49,12 @@ from distutils.command.install import install
from distutils.command.install_data import install_data
from distutils.util import convert_path
sys.path.insert(0, 'inst')
import versions
del sys.path[0]
ZOPE_VERSION = '%s%s-%s' % (versions.ZOPE_MAJOR_VERSION, versions.ZOPE_MINOR_VERSION, versions.VERSION_RELEASE_TAG)
class ZopeInstallData(install_data):
def finalize_options(self):
self.set_undefined_options('install',
......@@ -233,7 +239,7 @@ HEADER_PATH_ALIASES = {'zope.proxy': 'zope/proxy'}
# Create the finder instance, which will be used in lots of places. `finder'
# is the global we're most interested in.
IGNORE_EXTS = ('.pyc', '.pyo', '.c', '.h', '.so', '.cfg')
IGNORE_EXTS = ('.pyc', '.pyo', '.c', '.h', '.so', '.o', '.dll', '.lib', '.obj', '.cfg')
finder = Finder(IGNORE_EXTS, PACKAGES_ROOT)
for dirpath, dirnames, filenames in os.walk(PACKAGES_ROOT):
......@@ -254,13 +260,20 @@ class MyExtBuilder(build_ext):
# building extensions, but Zope's the build_ext -i variant
# is used to build Zope in place.
#
# Note that we also create symlinks for the oddball include
# Note that we also create make a copy for the oddball include
# directories used by some Zope3 extensions.
def run(self):
os.path.walk(os.curdir, remove_stale_bytecode, None)
for k, v in HEADER_PATH_ALIASES.items():
if not os.path.exists(k):
os.symlink(v, k)
if os.path.exists(k):
shutil.rmtree(k)
ignore = list(IGNORE_EXTS)
ignore.remove('.h')
f = Finder(tuple(ignore), v)
for dirpath, dirnames, filenames in os.walk(v):
if not '.svn' in dirpath:
f.visit(dirpath, filenames)
f.copy_files(self, k)
build_ext.run(self)
class MyLibInstaller(installcmd):
......@@ -280,7 +293,7 @@ class MyDistribution(Distribution):
self.cmdclass['install_lib'] = MyLibInstaller
EXTENSIONCLASS_INCLUDEDIRS = ['ExtensionClass', '.']
EXTENSIONCLASS_INCLUDEDIRS = ['ExtensionClass', '.']
# All extension modules must be listed here.
ext_modules = [
......
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