mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:Simplify build process
This commit is contained in:
parent
a33b1438e7
commit
584d89c50e
30
Makefile
30
Makefile
@ -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()"
|
|
@ -37,7 +37,9 @@ def main(args=sys.argv):
|
|||||||
if not translations_found:
|
if not translations_found:
|
||||||
print 'WARNING: Could not find Qt transations'
|
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
|
return 0
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
62
setup.py
62
setup.py
@ -47,9 +47,68 @@ main_functions = {
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from setuptools import setup, find_packages, Extension
|
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
|
from pyqtdistutils import PyQtExtension, build_ext
|
||||||
import subprocess, glob
|
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')
|
entry_points['console_scripts'].append('calibre_postinstall = calibre.linux:post_install')
|
||||||
ext_modules = [
|
ext_modules = [
|
||||||
Extension('calibre.plugins.lzx',
|
Extension('calibre.plugins.lzx',
|
||||||
@ -125,7 +184,8 @@ if __name__ == '__main__':
|
|||||||
'Topic :: Software Development :: Libraries :: Python Modules',
|
'Topic :: Software Development :: Libraries :: Python Modules',
|
||||||
'Topic :: System :: Hardware :: Hardware Drivers'
|
'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:
|
if 'develop' in ' '.join(sys.argv) and islinux:
|
||||||
|
@ -21,7 +21,7 @@ help:
|
|||||||
@echo " linkcheck to check all external links for integrity"
|
@echo " linkcheck to check all external links for integrity"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -rf .build/* cli
|
rm -rf .build/* cli
|
||||||
|
|
||||||
html:
|
html:
|
||||||
mkdir -p .build/html .build/doctrees
|
mkdir -p .build/html .build/doctrees
|
||||||
|
@ -201,14 +201,8 @@ def upload_docs():
|
|||||||
check_call('''scp docs/pdf/api.pdf divok:%s/'''%(DOCS,))
|
check_call('''scp docs/pdf/api.pdf divok:%s/'''%(DOCS,))
|
||||||
|
|
||||||
def upload_user_manual():
|
def upload_user_manual():
|
||||||
cwd = os.getcwdu()
|
check_call('python setup.py manual')
|
||||||
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)
|
check_call('scp -r .build/html/* divok:%s'%USER_MANUAL)
|
||||||
finally:
|
|
||||||
os.chdir(cwd)
|
|
||||||
|
|
||||||
def build_src_tarball():
|
def build_src_tarball():
|
||||||
check_call('bzr export dist/calibre-%s.tar.bz2'%__version__)
|
check_call('bzr export dist/calibre-%s.tar.bz2'%__version__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user