Commit a971c5b2 authored by Sidnei da Silva's avatar Sidnei da Silva

parents b88b06a4 2b5e19c5
...@@ -104,6 +104,7 @@ uninstance: ...@@ -104,6 +104,7 @@ uninstance:
clean: unbuild clean: unbuild
${FIND} "${BASE_DIR}" \ ${FIND} "${BASE_DIR}" \
-name '*.py[co]' -o -name '*.so' -o -name '*.o' | ${XARGS} ${RM} -name '*.py[co]' -o -name '*.so' -o -name '*.o' | ${XARGS} ${RM}
${RM} "$(BASE_DIR)/lib/python/version.txt"
${RMRF} build ${RMRF} build
# version_txt: create a version file in lib/python/version.txt # version_txt: create a version file in lib/python/version.txt
......
...@@ -10,7 +10,8 @@ RELEASE_TAG=<<VERSION_RELEASE_TAG>> ...@@ -10,7 +10,8 @@ RELEASE_TAG=<<VERSION_RELEASE_TAG>>
PACKAGE_NAME=$(NAME)-$(MAJOR_VERSION).$(MINOR_VERSION)-$(RELEASE_TAG) PACKAGE_NAME=$(NAME)-$(MAJOR_VERSION).$(MINOR_VERSION)-$(RELEASE_TAG)
PYTHON="<<PYTHON>>" PYTHON="<<PYTHON>>"
PREFIX=<<PREFIX>> TMPDIR="<<TMP_DIR>>"
PREFIX="<<PREFIX>>"
BASE_DIR=<<BASE_DIR>> BASE_DIR=<<BASE_DIR>>
BUILD_BASE=<<BUILD_BASE>> BUILD_BASE=<<BUILD_BASE>>
DISTUTILS_OPTS=<<DISTUTILS_OPTS>> DISTUTILS_OPTS=<<DISTUTILS_OPTS>>
...@@ -30,6 +31,7 @@ RMRF=deltree /y ...@@ -30,6 +31,7 @@ RMRF=deltree /y
CD=cd CD=cd
XCOPY=xcopy /i /s /e /y XCOPY=xcopy /i /s /e /y
COPY=copy COPY=copy
EXISTS=IF EXIST
default: build default: build
# default: The default step (invoked when make is called without a target) # default: The default step (invoked when make is called without a target)
...@@ -37,8 +39,8 @@ default: build ...@@ -37,8 +39,8 @@ default: build
@ echo Zope built. Next, do 'nmake install'. @ echo Zope built. Next, do 'nmake install'.
@ echo. @ echo.
.PHONY: clean install build unbuild .PHONY : clean install instance untestinst testinst build unbuild
.PHONY: default .PHONY : default
# build: Do whatever 'setup.py build' implies # build: Do whatever 'setup.py build' implies
build: build:
...@@ -47,27 +49,72 @@ build: ...@@ -47,27 +49,72 @@ build:
# unbuild: Remove the build directory (undo the make build step) # unbuild: Remove the build directory (undo the make build step)
unbuild: unbuild:
-$(RMRF) $(BUILD_BASE) -$(EXISTS) $(BUILD_BASE) $(RMRF) $(BUILD_BASE)
# install: Install a software home. # install: Install a software home.
install: build version_txt install: build version_txt
$(PYTHON) "$(BASE_DIR)\setup.py" $(DISTUTILS_OPTS) install \ $(PYTHON) "$(BASE_DIR)\setup.py" $(DISTUTILS_OPTS) install \
--prefix="$(PREFIX)" $(BUILD_FLAGS) $(INSTALL_FLAGS) --prefix="$(PREFIX)" $(BUILD_FLAGS) $(INSTALL_FLAGS)
@ echo. @ echo.
@ echo Zope binaries installed successfully. @ echo Zope binaries installed successfully.
@ echo Now run '$(PYTHON) $(PREFIX)\bin\mkzopeinstance.py' @ echo Now run '$(PYTHON) $(PREFIX)\bin\mkzopeinstance.py'
# version_txt: create a version file in lib/python/version.txt # inplace: Do an in-place build
version_txt: inplace:
echo Zope $(MAJOR_VERSION).$(MINOR_VERSION)-$(RELEASE_TAG) >\ $(MAKE) install PREFIX="$(BASE_DIR)"
"$(BASE_DIR)/lib/python/version.txt"
# test: Do an inplace build and run the Zope test suite.
test: inplace
$(PYTHON) "$(BASE_DIR)\test.py" $(TESTOPTS)
# instance: Do an inplace build and create an instance home in the resulting
# software home.
instance: build
$(PYTHON) "$(BASE_DIR)\utilities\mkzopeinstance.py" $(MKZ_FLAGS)
# testinst: Perform an inplace build and create an instance home in the
# resulting software home without asking questions. Useful when
# performing automated testing.
testinst:
$(MAKE) instance MKZ_FLAGS=--user=admin:admin --dir="$(BASE_DIR)"
# uninstance: Remove the instance files made by testinstance (w/ prejudice)
uninstance:
$(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 # clean: Delete the build files and any binaries/bytecode files in
# the source directory for good measure. # the source directory for good measure.
clean: unbuild clean:
$(CD) "$(BASE_DIR) $(CD) "$(BASE_DIR)"
-$(RM) /s *.pyc *.pyo *.dll *.o *.obj *.pyd -$(RM) /s *.pyc *.pyo *.dll *.o *.obj *.pyd
-$(RM) (BASE_DIR)\lib\python\version.txt -$(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"
# 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
$(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)
...@@ -38,6 +38,7 @@ Distutils setup for Zope ...@@ -38,6 +38,7 @@ Distutils setup for Zope
import glob import glob
import os import os
import sys import sys
import shutil
import distutils.core import distutils.core
...@@ -48,6 +49,12 @@ from distutils.command.install import install ...@@ -48,6 +49,12 @@ from distutils.command.install import install
from distutils.command.install_data import install_data from distutils.command.install_data import install_data
from distutils.util import convert_path 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): class ZopeInstallData(install_data):
def finalize_options(self): def finalize_options(self):
self.set_undefined_options('install', self.set_undefined_options('install',
...@@ -232,7 +239,7 @@ HEADER_PATH_ALIASES = {'zope.proxy': 'zope/proxy'} ...@@ -232,7 +239,7 @@ HEADER_PATH_ALIASES = {'zope.proxy': 'zope/proxy'}
# Create the finder instance, which will be used in lots of places. `finder' # Create the finder instance, which will be used in lots of places. `finder'
# is the global we're most interested in. # 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) finder = Finder(IGNORE_EXTS, PACKAGES_ROOT)
for dirpath, dirnames, filenames in os.walk(PACKAGES_ROOT): for dirpath, dirnames, filenames in os.walk(PACKAGES_ROOT):
...@@ -253,13 +260,20 @@ class MyExtBuilder(build_ext): ...@@ -253,13 +260,20 @@ class MyExtBuilder(build_ext):
# building extensions, but Zope's the build_ext -i variant # building extensions, but Zope's the build_ext -i variant
# is used to build Zope in place. # 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. # directories used by some Zope3 extensions.
def run(self): def run(self):
os.path.walk(os.curdir, remove_stale_bytecode, None) os.path.walk(os.curdir, remove_stale_bytecode, None)
for k, v in HEADER_PATH_ALIASES.items(): for k, v in HEADER_PATH_ALIASES.items():
if not os.path.exists(k): if os.path.exists(k):
os.symlink(v, 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) build_ext.run(self)
class MyLibInstaller(installcmd): class MyLibInstaller(installcmd):
...@@ -279,7 +293,7 @@ class MyDistribution(Distribution): ...@@ -279,7 +293,7 @@ class MyDistribution(Distribution):
self.cmdclass['install_lib'] = MyLibInstaller self.cmdclass['install_lib'] = MyLibInstaller
EXTENSIONCLASS_INCLUDEDIRS = ['ExtensionClass', '.'] EXTENSIONCLASS_INCLUDEDIRS = ['ExtensionClass', '.']
# All extension modules must be listed here. # All extension modules must be listed here.
ext_modules = [ 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