Ticket #13245: trac_13245-clone-cython.patch

File trac_13245-clone-cython.patch, 1.7 KB (added by jhpalmieri, 7 years ago)
  • sage-clone

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1363024384 25200
    # Node ID 60a64dc59abcf88480a0e02ff914fad9a2762b11
    # Parent  f035f1f0ef9f4bd70a7d8921ca485fe0f2abe2bd
    sage-clone: copy over autogenerated .h files, and also .cython_version
    
    diff --git a/sage-clone b/sage-clone
    a b  
    3636    print "Error cloning"
    3737    sys.exit(1)
    3838
    39 print "Copying over all Cython auto-generated .c, .cpp and .h files..."
    4039def cpdir(src, dest):
     40    """
     41    Copy autogenerated .c, .cpp and .h files
     42    """
     43    # Text possibly appearing in the first line of autogenerated files:
     44    first_lines = ['Generated by Cython', # .c, .cpp files
     45                   '#ifndef __PYX_HAVE__sage']  # .h files
    4146    if not os.path.isdir(dest):
    4247        return
    4348    for F in os.listdir(src):
     
    4651        else:
    4752            ext = os.path.splitext(F)[-1]
    4853            if ext in ['.h', '.c', '.cpp']:
    49                 if 'Cython' in open(src + '/' + F).readline():
     54                if any(line in open(src + '/' + F).readline()
     55                       for line in first_lines):
    5056                    os.link(src + '/' + F, dest + '/' +F)
    5157                    os.utime(dest + '/' +F, None)
    52                      
    5358
     59print "Copying over all Cython auto-generated .c, .cpp and .h files..."
    5460cpdir(os.path.abspath('sage/sage'), os.path.abspath(branch + '/sage'))
    5561
     62if os.path.isfile('sage/.cython_version'):
     63    print "Copying over hidden Cython version file..."
     64    os.link('sage/.cython_version', branch+'/.cython_version')
     65
    5666def copy_dtree(src_dir, dest_dir):
    5767    src_root = os.path.abspath(src_dir)
    5868    dest_root = os.path.abspath(dest_dir)