File: versions.helper

package info (click to toggle)
python-numpy 1%3A1.12.1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,732 kB
  • ctags: 19,262
  • sloc: ansic: 146,995; python: 98,088; cpp: 1,112; makefile: 425; f90: 307; sh: 173; fortran: 169; perl: 58
file content (32 lines) | stat: -rw-r--r-- 937 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/python

'''
Check if debian/versions is sane and generate substvars for numpy:Provides.
'''

import os

def main():
    os.chdir(os.path.join(os.path.dirname(__file__), '..'))
    data = {}
    file = open('numpy/core/setup_common.py', 'r')
    try:
        exec(file.read(), data)
    finally:
        file.close()
    file = open('debian/versions', 'r')
    try:
        for line in file:
            line = line.strip()
            if not line or line.startswith('#'):
                continue
            key, value = line.split(None, 1)
            data[key] = value
    finally:
        file.close()
    assert data['abi'] == str(data['C_ABI_VERSION'] - 0x1000000), 'Is debian/versions up-to-date?'
    assert data['api'] == str(data['C_API_VERSION']), 'Is debian/versions up-to-date?'
    print 'numpy:Provides=python-numpy-abi%s, python-numpy-api%s' % (data['abi'], data['api'])

if __name__ == '__main__':
    main()