File: wscript_configure

package info (click to toggle)
geany-plugins 1.24%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 17,532 kB
  • ctags: 10,926
  • sloc: ansic: 89,639; sh: 11,434; python: 1,365; makefile: 1,302
file content (80 lines) | stat: -rw-r--r-- 3,030 bytes parent folder | download | duplicates (2)
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
# -*- coding: utf-8 -*-
#
# WAF build script for geany-plugins - GeanyPy
#
# Copyright 2013 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

from build.wafutils import add_to_env_and_define, check_cfg_cached, target_is_win32
from waflib.Errors import ConfigurationError

PYTHON_DETECT_DSO_CODE = """
from distutils.sysconfig import get_config_vars
from os.path import join as path_join

cvars = get_config_vars()
# support multiarch-enabled distributions like Ubuntu
if not 'MULTIARCH' in cvars.keys():
    cvars['MULTIARCH'] = ''
print(path_join(cvars['LIBDIR'], cvars['MULTIARCH'], cvars['LDLIBRARY']))
"""

# Python
conf.load('python')
conf.check_python_version((2, 6))
conf.check_python_headers()

if conf.env['PYTHON_VERSION'][0] == '3':
    raise ConfigurationError('Python3 is not supported')

# PyGTK
check_cfg_cached(conf,
                 package='pygtk-2.0',
                 uselib_store="PYGTK",
                 mandatory=True,
                 args='--cflags --libs')

# try to find the Python DSO path, for details see geanypy/m4/ax_python_library.m4
conf.start_msg('Checking for python DSO path')
try:
    dso_path = conf.cmd_and_log(conf.env['PYTHON'] + ['-c', PYTHON_DETECT_DSO_CODE])
    if not dso_path:
        conf.fatal('not found')
except:
    conf.end_msg(False)
    conf.fatal('Could not find the python DSO path')
else:
    dso_path = dso_path.strip()
    add_to_env_and_define(conf, 'GEANYPY_PYTHON_LIBRARY', dso_path, quote=True)
    conf.end_msg(dso_path)

# work around for Debian Python bug (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695979)
if not 'LIB_PYEXT' in conf.env:
    conf.env['LIBPATH_PYEXT'] = conf.env['LIBPATH_PYEMBED']
    conf.env['LIB_PYEXT'] = conf.env['LIB_PYEMBED']

# dirs
is_win32 = target_is_win32(conf)
if is_win32:
    geanypy_lib_path = '%s/lib/geany-plugins/geanypy' % conf.env['G_PREFIX']
    geanypy_data_path = '%s/%s/geany-plugins/geanypy' % (
        conf.env['G_PREFIX'], conf.env['GEANYPLUGINS_DATADIR'])
else:
    geanypy_lib_path = '%s/geany-plugins/geanypy' % conf.env['LIBDIR']
    geanypy_data_path = '%s/geany-plugins/geanypy' % conf.env['GEANYPLUGINS_DATADIR']

add_to_env_and_define(conf, 'GEANYPY_PYTHON_DIR', geanypy_lib_path, quote=True)
add_to_env_and_define(conf, 'GEANYPY_PLUGIN_DIR', '%s/plugins' % geanypy_data_path, quote=True)