[PATCH 6 of 7] setup: build the documentation in a subdirectory of `build_temp'
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Tue Dec 1 14:33:16 CST 2009
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1259681075 -3600
# Node ID ad2cffaeaf9295596973b940c43f274aafd42a0a
# Parent 2b45949ca5a918731ceaa20f4d6c46a89a9a7135
setup: build the documentation in a subdirectory of `build_temp'.
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,9 @@ all: build
local:
$(PYTHON) setup.py $(PURE) --doc-format '' \
- build_py -c -d . build_ext -i build_mo
+ build_py --compile --build-lib . \
+ build_ext --inplace \
+ build_mo --build-lib .
$(PYTHON) hg version
build:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -238,12 +238,12 @@ class build_mo(build):
pofile = join(podir, po)
modir = join('locale', po[:-3], 'LC_MESSAGES')
mofile = join(modir, 'hg.mo')
- mobuildfile = join('mercurial', mofile)
+ mobuildfile = join(self.build_lib, 'mercurial', mofile)
cmd = ['msgfmt', '-v', '-o', mobuildfile, pofile]
if sys.platform != 'sunos5':
# msgfmt on Solaris does not know about -c
cmd.append('-c')
- self.mkpath(join('mercurial', modir))
+ self.mkpath(join(self.build_lib, 'mercurial', modir))
self.make_file([pofile], mobuildfile, spawn, (cmd,))
datafiles.append(mofile)
@@ -312,27 +312,33 @@ class build_doc(build):
self.warn("could not find doc directory")
return
+ # avoid cluttering the source directory by copying all documentation
+ # files to the build by-products directory
+ build_dir = join(self.build_temp, 'doc')
+ self.mkpath(build_dir)
+ self.copy_tree('doc', build_dir)
+
# update extracted documentation
self.execute(self.extract_documentation,
- [join('doc', 'hg.1.gendoc.txt')],
+ [join(build_dir, 'hg.1.gendoc.txt')],
('extracting %s from source files'
- % join('doc', 'hg.1.gendoc.txt')))
+ % join(build_dir, 'hg.1.gendoc.txt')))
datafiles = self.distribution.data_files
if 'html' in doc_formats:
- datafiles.append(('$install_html', [join('doc', 'style.css')]))
+ datafiles.append(('$install_html', [join(build_dir, 'style.css')]))
- for srcfile in fnmatch.filter(os.listdir('doc'),
+ for srcfile in fnmatch.filter(os.listdir(build_dir),
"*.[1-9].txt"):
base = os.path.splitext(srcfile)[0]
name, category = base.rsplit('.', 1)
- srcfile = join('doc', srcfile)
+ srcfile = join(build_dir, srcfile)
# manual file name is e.g. XXX.N
- manfile = join('doc', base)
+ manfile = join(build_dir, base)
# HTML file name is e.g. XXX.N.html
- htmlfile = join('doc', base + '.html')
+ htmlfile = join(build_dir, base + '.html')
# reader & writer classes
# NOTE: writers.get_writer_class('manpage') may be used eventually
More information about the Mercurial-devel
mailing list