File: __init__.py

package info (click to toggle)
cypari2 2.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 908 kB
  • sloc: python: 972; makefile: 34; ansic: 5
file content (26 lines) | stat: -rw-r--r-- 731 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
from __future__ import absolute_import

import glob
import os
from os.path import join, getmtime, exists

from .generator import PariFunctionGenerator
from .paths import pari_share


def rebuild(force=False):
    pari_module_path = 'cypari2'
    src_files = [join(pari_share(), 'pari.desc')] + \
                 glob.glob(join('autogen', '*.py'))
    gen_files = [join(pari_module_path, 'auto_paridecl.pxd'),
                 join(pari_module_path, 'auto_gen.pxi')]

    if not force and all(exists(f) for f in gen_files):
        src_mtime = max(getmtime(f) for f in src_files)
        gen_mtime = min(getmtime(f) for f in gen_files)

        if gen_mtime > src_mtime:
            return

    G = PariFunctionGenerator()
    G()