Commit 200072dc384b94d977ba66a66f902fcf406fbd9b
1 parent
5af4d9c3
Added update script
Showing
3 changed files
with
36 additions
and
30 deletions
cmake/DownloadProject.CMakeLists.cmake.in
| 1 | +# Distributed under the OSI-approved MIT License. See accompanying | ||
| 2 | +# file LICENSE or https://github.com/Crascit/DownloadProject for details. | ||
| 3 | + | ||
| 1 | cmake_minimum_required(VERSION 2.8.2) | 4 | cmake_minimum_required(VERSION 2.8.2) |
| 2 | 5 | ||
| 3 | project(${DL_ARGS_PROJ}-download NONE) | 6 | project(${DL_ARGS_PROJ}-download NONE) |
cmake/DownloadProject.cmake
| 1 | +# Distributed under the OSI-approved MIT License. See accompanying | ||
| 2 | +# file LICENSE or https://github.com/Crascit/DownloadProject for details. | ||
| 3 | +# | ||
| 1 | # MODULE: DownloadProject | 4 | # MODULE: DownloadProject |
| 2 | # | 5 | # |
| 3 | # PROVIDES: | 6 | # PROVIDES: |
| @@ -73,7 +76,7 @@ | @@ -73,7 +76,7 @@ | ||
| 73 | # | 76 | # |
| 74 | # EXAMPLE USAGE: | 77 | # EXAMPLE USAGE: |
| 75 | # | 78 | # |
| 76 | -# include(DownloadProject.cmake) | 79 | +# include(DownloadProject) |
| 77 | # download_project(PROJ googletest | 80 | # download_project(PROJ googletest |
| 78 | # GIT_REPOSITORY https://github.com/google/googletest.git | 81 | # GIT_REPOSITORY https://github.com/google/googletest.git |
| 79 | # GIT_TAG master | 82 | # GIT_TAG master |
| @@ -83,35 +86,6 @@ | @@ -83,35 +86,6 @@ | ||
| 83 | # | 86 | # |
| 84 | # add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) | 87 | # add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) |
| 85 | # | 88 | # |
| 86 | -# | ||
| 87 | -# SOURCE: | ||
| 88 | -# | ||
| 89 | -# https://github.com/Crascit/DownloadProject | ||
| 90 | -# | ||
| 91 | -# LICENSE: | ||
| 92 | -# | ||
| 93 | -# The MIT License (MIT) | ||
| 94 | -# | ||
| 95 | -# Copyright (c) 2015 Crascit | ||
| 96 | -# | ||
| 97 | -# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 98 | -# of this software and associated documentation files (the "Software"), to deal | ||
| 99 | -# in the Software without restriction, including without limitation the rights | ||
| 100 | -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 101 | -# copies of the Software, and to permit persons to whom the Software is | ||
| 102 | -# furnished to do so, subject to the following conditions: | ||
| 103 | -# | ||
| 104 | -# The above copyright notice and this permission notice shall be included in all | ||
| 105 | -# copies or substantial portions of the Software. | ||
| 106 | -# | ||
| 107 | -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 108 | -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 109 | -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 110 | -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 111 | -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 112 | -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 113 | -# SOFTWARE. | ||
| 114 | -# | ||
| 115 | #======================================================================================== | 89 | #======================================================================================== |
| 116 | 90 | ||
| 117 | 91 |
scripts/UpdateDownloadProj.py
0 → 100755
| 1 | +#!/usr/bin/env python | ||
| 2 | + | ||
| 3 | +from __future__ import print_function, division | ||
| 4 | + | ||
| 5 | +from plumbum import local, cli, FG | ||
| 6 | + | ||
| 7 | +FILES = [ 'https://raw.githubusercontent.com/Crascit/DownloadProject/master/DownloadProject.cmake', | ||
| 8 | + 'https://raw.githubusercontent.com/Crascit/DownloadProject/master/DownloadProject.CMakeLists.cmake.in'] | ||
| 9 | + | ||
| 10 | +DIR = local.path(__file__).dirname | ||
| 11 | + | ||
| 12 | +def download_file(path): | ||
| 13 | + try: | ||
| 14 | + from plumbum.cmd import wget | ||
| 15 | + wget[path] & FG | ||
| 16 | + | ||
| 17 | + except ImportError: | ||
| 18 | + from plumbum.cmd import curl | ||
| 19 | + name = path.split('/')[-1] | ||
| 20 | + (curl[path] > name) & FG | ||
| 21 | + | ||
| 22 | +class UpdateDownloadProj(cli.Application): | ||
| 23 | + def main(self): | ||
| 24 | + with local.cwd(DIR / '../cmake'): | ||
| 25 | + for f in FILES: | ||
| 26 | + download_file(f) | ||
| 27 | + | ||
| 28 | +if __name__ == "__main__": | ||
| 29 | + UpdateDownloadProj() |