예제 #1
0
def _ptrepack(src, dst, complevel, complib):
    """run ptrepack to repack from src to dst"""
    with _sysargs_hacks():
        sys.argv = [
            '',
            '--complevel=%s' % complevel,
            '--complib=%s' % complib, src, dst
        ]
        with _filter_warnings():
            ptrepack.main()
예제 #2
0
파일: persist.py 프로젝트: jorahn/icy
def repack_h5(filename):
    print('repacking store ... \t', end='')
    backup = deepcopy(sys.argv)
    sys.argv = 'ptrepack --chunkshape=auto --propindexes --complevel=9 --complib=blosc {} {}'.format(filename, 'tmp.h5').split(' ')
    ptrepack.main()
    os.remove(filename)
    os.rename(tmp, filename)
    sys.argv = backup
    print('[OK]')
    return
예제 #3
0
파일: hdf5.py 프로젝트: ocefpaf/ulmo
def _ptrepack(src, dst, complevel, complib):
    """run ptrepack to repack from src to dst"""

    #check_output(['ptrepack','--complevel=%s' % complevel, '--complib=%s' % complib, src, dst])
    
    #fix for for pytables not finding files on windows because of drive in path 
    src = os.path.splitdrive(src)[-1]
    dst = os.path.splitdrive(dst)[-1]

    with _sysargs_hacks():
        sys.argv = ['', '--complevel=%s' % complevel, '--complib=%s' % complib, src, dst]
        with _filter_warnings():
            ptrepack.main()
예제 #4
0
def _ptrepack(src, dst, complevel, complib):
    """run ptrepack to repack from src to dst"""

    #check_output(['ptrepack','--complevel=%s' % complevel, '--complib=%s' % complib, src, dst])
    
    #fix for for pytables not finding files on windows because of drive in path 
    src = os.path.splitdrive(src)[-1]
    dst = os.path.splitdrive(dst)[-1]

    with _sysargs_hacks():
        sys.argv = ['', '--complevel=%s' % complevel, '--complib=%s' % complib, src, dst]
        with _filter_warnings():
            ptrepack.main()
예제 #5
0
    def test_paths_windows(self, mock_open_file, mock_copy_leaf):
        """Checking handling of windows filenames: test gh-616"""

        # this filename has a semi-colon to check for
        # regression of gh-616
        src_fn = 'D:\\window~1\\path\\000\\infile'
        src_path = '/'
        dst_fn = 'another\\path\\'
        dst_path = '/path/in/outfile'

        argv = ['ptrepack', src_fn + ':' + src_path, dst_fn + ':' + dst_path]
        with patch.object(sys, 'argv', argv):
            ptrepack.main()

        args, kwargs = mock_open_file.call_args_list[0]
        self.assertEqual(args, (src_fn, 'r'))

        args, kwargs = mock_copy_leaf.call_args_list[0]
        self.assertEqual(args, (src_fn, dst_fn, src_path, dst_path))
예제 #6
0
    def test_paths_windows(self, mock_open_file, mock_copy_leaf):
        """Checking handling of windows filenames: test gh-616"""

        # this filename has a semi-colon to check for
        # regression of gh-616
        src_fn = 'D:\\window~1\\path\\000\\infile'
        src_path = '/'
        dst_fn = 'another\\path\\'
        dst_path = '/path/in/outfile'

        argv = ['ptrepack', src_fn + ':' + src_path, dst_fn + ':' + dst_path]
        with patch.object(sys, 'argv', argv):
            ptrepack.main()

        args, kwargs = mock_open_file.call_args_list[0]
        self.assertEqual(args, (src_fn, 'r'))

        args, kwargs = mock_copy_leaf.call_args_list[0]
        self.assertEqual(args, (src_fn, dst_fn, src_path, dst_path))
예제 #7
0
파일: hdf5.py 프로젝트: ashi-twdb/ulmo
def _ptrepack(src, dst, complevel, complib):
    """run ptrepack to repack from src to dst"""
    with _sysargs_hacks():
        sys.argv = ['', '--complevel=%s' % complevel, '--complib=%s' % complib, src, dst]
        with _filter_warnings():
            ptrepack.main()
if __name__ == '__main__':
    import sys
    from tables.scripts.ptrepack import main

    sys.exit(main())
예제 #9
0
if __name__ == '__main__':
    import sys
    from tables.scripts.ptrepack import main

    sys.exit(main())