File: versions.helper

package info (click to toggle)
python-numpy 1%3A1.8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 21,336 kB
  • ctags: 18,503
  • sloc: ansic: 149,662; python: 85,440; cpp: 968; makefile: 367; f90: 164; sh: 130; fortran: 125; 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()