[Synopsis-cvs] Synopsis/Synopsis/Synopsis/dist/command __init__.py,NONE,1.1 build.py,NONE,1.1 build_doc.py,NONE,1.1 build_ext.py,NONE,1.1 config.py,NONE,1.1
Stefan Seefeld stefan at frida.spi-inc.orgWed Sep 17 19:55:04 UTC 2003
- Previous message: [Synopsis-cvs] Synopsis/Synopsis/Synopsis/Parser/C++ Makefile.in,NONE,1.1 configure.ac,NONE,1.1
- Next message: [Synopsis-cvs] Synopsis/Synopsis/Synopsis/dist/command config.py,1.1,1.2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /cvs/synopsis/Synopsis/Synopsis/dist/command
In directory frida:/tmp/cvs-serv11210/Synopsis/dist/command
Added Files:
__init__.py build.py build_doc.py build_ext.py config.py
Log Message:
work on a distutils based build system.
--- NEW FILE: __init__.py ---
--- NEW FILE: build.py ---
import os, sys, string
from distutils.command import build
class build(build.build):
sub_commands = build.build.sub_commands[:] + [('build_doc', None)]
--- NEW FILE: build_doc.py ---
import os, sys, string
from distutils.command import build
from distutils.dir_util import mkpath
from distutils.spawn import spawn, find_executable
from shutil import *
class build_doc(build.build):
description = "build documentation"
def run(self):
xmlto = find_executable('xmlto')
if not xmlto:
self.announce("cannot build html docs without 'xmlto'")
return
self.announce("building html manual")
srcdir = os.path.abspath('docs/Manual/')
tempdir = os.path.abspath(os.path.join(self.build_temp, 'share/doc/synopsis'))
builddir = os.path.abspath(os.path.join(self.build_lib, 'share/doc/synopsis'))
cwd = os.getcwd()
mkpath(tempdir, 0777, self.verbose, self.dry_run)
os.chdir(tempdir)
spawn([xmlto, '--skip-validation', '-o', 'html',
'-m', os.path.join(srcdir, 'synopsis-html.xsl'),
'html', os.path.join(srcdir, 'synopsis.xml')])
mkpath(builddir, 0777, self.verbose, self.dry_run)
if os.path.isdir(os.path.join(builddir, 'html')):
rmtree(os.path.join(builddir, 'html'), 1)
copytree(os.path.join(tempdir, 'html'), os.path.join(builddir, 'html'))
docbook2pdf = find_executable('docbook2pdf')
if not docbook2pdf:
self.announce("cannot build pdf docs without 'docbook2pdf'")
return
self.announce("building pdf manual")
spawn([docbook2pdf, os.path.join(srcdir, 'synopsis.xml')])
copy2('synopsis.pdf', builddir)
os.chdir(cwd)
--- NEW FILE: build_ext.py ---
import os, sys, string
from distutils.command import build_ext
from distutils.dir_util import mkpath
from distutils.spawn import spawn, find_executable
from shutil import *
class build_ext(build_ext.build_ext):
extensions = ['Synopsis/Parser/C', 'Synopsis/Parser/C++']
def run(self):
for ext in build_ext.extensions:
self.build_extension(ext)
def get_source_files(self):
def collect(arg, path, files):
files.extend(os.listdir(path))
print path, os.listdir(path)
files = []
for ext in build_ext.extensions:
print 'walking', ext
os.path.walk(ext,
#lambda arg, path, files : print path, os.listdir(path),
collect,
files)
print files
return files
def build_extension(self, ext):
self.announce("building '%s'" % ext)
path = os.path.join(self.build_temp, ext)
if not os.path.exists(path):
self.run_command('config')
command = "make -C %s"%(path)
spawn(['sh', '-c', command], self.verbose, self.dry_run)
#if self.build_temp != self.build_lib:
--- NEW FILE: config.py ---
import os, sys, string
from distutils.core import setup
from distutils.command import build, build_ext
from distutils.util import get_platform
from distutils.dir_util import mkpath
from distutils.spawn import spawn, find_executable
from shutil import *
class config(build.build):
"""derive from build since we use almost all the same options"""
description = "configure the package"
extensions = ['Synopsis/Parser/C', 'Synopsis/Parser/C++']
def run(self):
self.config_extensions()
def config_extensions(self):
for ext in config.extensions:
self.config_extension(ext)
def config_extension(self, ext):
self.announce("configuring '%s'" % ext)
path = os.path.join(self.build_temp, ext)
mkpath (path, 0777, self.verbose, self.dry_run)
srcdir = os.path.abspath(ext)
tempdir = os.path.abspath(os.path.join(self.build_temp, ext))
builddir = os.path.abspath(os.path.join(self.build_lib, ext))
configure = os.path.join(srcdir, 'configure')
cwd = os.getcwd()
mkpath(tempdir, 0777, self.verbose, self.dry_run)
os.chdir(tempdir)
command = "%s/configure --with-python=%s"%(srcdir, sys.executable)
spawn(['sh', '-c', command], self.verbose, self.dry_run)
os.chdir(cwd)
- Previous message: [Synopsis-cvs] Synopsis/Synopsis/Synopsis/Parser/C++ Makefile.in,NONE,1.1 configure.ac,NONE,1.1
- Next message: [Synopsis-cvs] Synopsis/Synopsis/Synopsis/dist/command config.py,1.1,1.2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Synopsis-changes mailing list