IGN:Simplify build process

This commit is contained in:
Kovid Goyal 2008-08-16 18:18:17 -07:00
parent a33b1438e7
commit 584d89c50e
5 changed files with 68 additions and 42 deletions

View File

@ -1,30 +0,0 @@
PYTHON = python
all : gui2 translations resources
clean :
cd src/calibre/gui2 && ${PYTHON} make.py clean
gui2 :
cd src/calibre/gui2 && ${PYTHON} make.py
test : gui2
cd src/calibre/gui2 && ${PYTHON} make.py test
translations :
cd src/calibre/translations && ${PYTHON} __init__.py
resources:
${PYTHON} resources.py
manual:
make -C src/calibre/manual clean html
pot :
cd src/calibre/translations && ${PYTHON} __init__.py pot
egg :
${PYTHON} setup.py bdist_egg --exclude-source-files
linux_binary:
${PYTHON} -c "import upload; upload._build_linux()"

View File

@ -37,7 +37,9 @@ def main(args=sys.argv):
if not translations_found:
print 'WARNING: Could not find Qt transations'
open('src'+os.sep+__appname__+os.sep+'/resources.py', 'wb').write(data)
dest = os.path.abspath(os.path.join('src', __appname__, 'resources.py'))
print 'Writing resources to', dest
open(dest, 'wb').write(data)
return 0
if __name__ == '__main__':

View File

@ -47,9 +47,68 @@ main_functions = {
if __name__ == '__main__':
from setuptools import setup, find_packages, Extension
from distutils.command.build import build as _build
from distutils.core import Command
from pyqtdistutils import PyQtExtension, build_ext
import subprocess, glob
class pot(Command):
user_options = []
def initialize_options(self): pass
def finalize_options(self): pass
def run(self):
from calibre.translations import create_pot
create_pot()
def build_manual():
cwd = os.path.abspath(os.getcwd())
os.chdir(os.path.join('src', 'calibre', 'manual'))
try:
for d in ('.build', 'cli'):
if os.path.exists(d):
shutil.rmtree(d)
os.makedirs(d)
if not os.path.exists('.build'+os.sep+'html'):
os.makedirs('.build'+os.sep+'html')
subprocess.check_call(['sphinx-build', '-b', 'custom', '-d',
'.build/doctrees', '.', '.build/html'])
finally:
os.chdir(cwd)
class manual(Command):
user_options = []
def initialize_options(self): pass
def finalize_options(self): pass
def run(self):
build_manual()
class build(_build):
def run(self):
# Build resources
resources = __import__('resources')
resources.main([sys.executable, 'resources.py'])
from calibre.translations import main as translations
cwd = os.path.abspath(os.getcwd())
# Build translations
try:
os.chdir(os.path.join('src', 'calibre', 'translations'))
translations([sys.executable])
finally:
os.chdir(cwd)
# Build GUI
from calibre.gui2.make import main as gui2
try:
os.chdir(os.path.join('src', 'calibre', 'gui2'))
print 'Compiling GUI resources...'
gui2([sys.executable])
finally:
os.chdir(cwd)
_build.run(self)
entry_points['console_scripts'].append('calibre_postinstall = calibre.linux:post_install')
ext_modules = [
Extension('calibre.plugins.lzx',
@ -125,7 +184,8 @@ if __name__ == '__main__':
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Hardware :: Hardware Drivers'
],
cmdclass = {'build_ext': build_ext},
cmdclass = {'build_ext': build_ext, 'build' : build, 'pot' : pot,
'manual' : manual},
)
if 'develop' in ' '.join(sys.argv) and islinux:

View File

@ -21,7 +21,7 @@ help:
@echo " linkcheck to check all external links for integrity"
clean:
-rm -rf .build/* cli
rm -rf .build/* cli
html:
mkdir -p .build/html .build/doctrees

View File

@ -201,15 +201,9 @@ def upload_docs():
check_call('''scp docs/pdf/api.pdf divok:%s/'''%(DOCS,))
def upload_user_manual():
cwd = os.getcwdu()
os.chdir('src/calibre/manual')
try:
check_call('make clean html')
check_call('ssh divok rm -rf %s/\\*'%USER_MANUAL)
check_call('scp -r .build/html/* divok:%s'%USER_MANUAL)
finally:
os.chdir(cwd)
check_call('python setup.py manual')
check_call('scp -r .build/html/* divok:%s'%USER_MANUAL)
def build_src_tarball():
check_call('bzr export dist/calibre-%s.tar.bz2'%__version__)