File: wscript

package info (click to toggle)
py3cairo 1.10.0+dfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,520 kB
  • ctags: 2,416
  • sloc: python: 12,338; ansic: 4,885; makefile: 160; sh: 32
file content (92 lines) | stat: -rw-r--r-- 2,127 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# -*- python -*-

import os

top = '.'
out = 'build_directory'
d = top

APPNAME='pycairo'
VERSION='1.10.0'
cairo_version_required = '1.10.0'


def options(ctx):
  print('  %s/options()' %d)
  ctx.tool_options('gnu_dirs')
  ctx.tool_options('compiler_cc')
  ctx.tool_options('python') # options for disabling pyc or pyo compilation


def configure(ctx):
  print('  %s/configure()' %d)

  env = ctx.env
  ctx.check_tool('gnu_dirs')
  ctx.check_tool('compiler_cc')
  ctx.check_tool('python')
  ctx.check_python_version((3,1,0))
  ctx.check_python_headers()
  ctx.check_cfg(package='cairo', atleast_version=cairo_version_required,
                args='--cflags --libs')

  # add gcc options
  if env['CC_NAME'] == 'gcc':
    env.append_unique('CCFLAGS', ['-std=c99', '-Wall'])

  version = [int(s) for s in VERSION.split('.')]
  ctx.define('VERSION', VERSION)
  ctx.define('PYCAIRO_VERSION_MAJOR', version[0])
  ctx.define('PYCAIRO_VERSION_MINOR', version[1])
  ctx.define('PYCAIRO_VERSION_MICRO', version[2])

  ctx.write_config_header('src/config.h')

  print("Configuration:")
  print("%-40s : %s" % ('PREFIX', env['PREFIX']))
  print("%-40s : %s" % ('LIBDIR', env['LIBDIR']))


def build(ctx):
  print('  %s/build()' %d)
  ctx.recurse('src')

  # generate and install the .pc file
  ctx(
    features = 'subst',
    source   = 'py3cairo.pc.in',
    target   = 'py3cairo.pc',
    dct      = {
      'VERSION'   : VERSION,
      'prefix'    : ctx.env['PREFIX'],
      'includedir': os.path.join(ctx.env['PREFIX'], 'include'),
      },
    install_path = os.path.join(ctx.env['LIBDIR'], 'pkgconfig'),
    )


def dist(ctx):
  # exclude these files from the distribution archive
  exclude = (
    'build_directory/',
    'doc/html_docs_create.sh',
    'doc/html_docs_upload.sh',
    'doc/_static/',
    'doc/_templates/',
    'doc/_build/doctrees/',
    'doc/_build/html/_sources/',
    'examples/cairo_snippets/c_to_python.py',
    'RELEASING',

    '.git/',
    '**/.gitignore',
    '**/.lock-w*',
    '.waf*',

    '**/*.pdf',
    '**/*.png',
    '**/*.pyc',
    '**/*.ps',
    '**/*.svg',
    )
  ctx.excl = ' '.join(exclude)