def main(triple): src_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")) data = bootstrap.stage0_data(src_root) channel, date = data['rustc'].split('-', 1) dl_dir = 'dl' if not os.path.exists(dl_dir): os.makedirs(dl_dir) filename = 'rustc-{}-{}.tar.gz'.format(channel, triple) url = 'https://static.rust-lang.org/dist/{}/{}'.format(date, filename) dst = dl_dir + '/' + filename if os.path.exists(dst): os.unlink(dst) bootstrap.get(url, dst) stage0_dst = triple + '/stage0' if os.path.exists(stage0_dst): for root, _, files in os.walk(stage0_dst): for f in files: os.unlink(os.path.join(root, f)) else: os.makedirs(stage0_dst) bootstrap.unpack(dst, stage0_dst, match='rustc', verbose=True)
def main(argv): src_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")) triple = argv[1] data = bootstrap.stage0_data(src_root) channel, date = data['rustc'].split('-', 1) dl_dir = 'dl' if not os.path.exists(dl_dir): os.makedirs(dl_dir) filename_base = 'rustc-' + channel + '-' + triple filename = filename_base + '.tar.gz' url = 'https://static.rust-lang.org/dist/' + date + '/' + filename dst = dl_dir + '/' + filename if not os.path.exists(dst): bootstrap.get(url, dst) stage0_dst = triple + '/stage0' if os.path.exists(stage0_dst): for root, _, files in os.walk(stage0_dst): for f in files: os.unlink(os.path.join(root, f)) else: os.makedirs(stage0_dst) bootstrap.unpack(dst, stage0_dst, match='rustc', verbose=True)
def test_stage0_data(self): """Extract data from stage0.txt""" expected = { "date": "2017-06-15", "rustc": "beta", "cargo": "beta", "rustfmt": "beta" } data = bootstrap.stage0_data(self.rust_root) self.assertDictEqual(data, expected)
def test_stage0_data(self): """Extract data from stage0.txt""" expected = {"date": "2017-06-15", "rustc": "beta", "cargo": "beta"} data = bootstrap.stage0_data(self.rust_root) self.assertDictEqual(data, expected)