2
# -*- coding: utf-8 -*-
3
# Copyright: (C) 2013 Canonical
8
# This program is free software; you can redistribute it and/or modify it under
9
# the terms of the GNU General Public License as published by the Free Software
10
# Foundation; version 3.
12
# This program is distributed in the hope that it will be useful, but WITHOUT
13
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17
# You should have received a copy of the GNU General Public License along with
18
# this program; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26
def copy_data_file(filename, dest, dest_filename=''):
27
'''copy filename to dest'''
29
dest = os.path.join(dest, dest_filename)
30
shutil.copy(os.path.join(os.path.dirname(__file__), 'data', filename), dest)
33
if __name__ == '__main__':
35
if os.environ.get("MOCK_ERROR_MODE") == "1":
36
sys.stderr.write('error asked for rsync\n')
39
commands = " ".join(sys.argv[1:])
41
if commands == '--remove-source-files --timeout=60 rsync://default/cu2d_out/packagelist_rsync* .':
42
copy_data_file('packagelist_rsync_foo-front', '.')
43
copy_data_file('packagelist_rsync_oif-head', '.')
45
elif commands == '--remove-source-files --timeout=60 rsync://nothing/cu2d_out/packagelist_rsync* .':