Initial commit.

This commit is contained in:
Achim D. Brucker 2017-09-06 23:32:03 +01:00
parent 3b2913616b
commit 2b63192bc2
1 changed files with 60 additions and 0 deletions

60
cdnjs-git-miner Executable file
View File

@ -0,0 +1,60 @@
#!/usr/bin/env python3.5
#
# Copyright (C) 2016,2017 The University of Sheffield, UK
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
""" Tool for mining the cdnjs git repository"""
import getopt
import logging
import sys
from ExtensionCrawler.config import const_log_format
# Script should run with python 3.4 or 3.5
assert sys.version_info >= (3, 4) and sys.version_info < (3, 6)
def helpmsg():
"""Print help message."""
print("cdnjs-git-miner [OPTION]")
print(" -h print this help text")
def main(argv):
"""Main function of the extension crawler."""
basedir = "archive"
verbose = True
force = False
clean = False
try:
opts, args = getopt.getopt(argv, "h")
except getopt.GetoptError:
helpmsg()
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
helpmsg()
sys.exit()
logger = logging.getLogger()
ch = logging.StreamHandler(sys.stdout)
ch.setFormatter(logging.Formatter(const_log_format()))
logger.addHandler(ch)
logger.setLevel(loglevel)
if __name__ == "__main__":
main(sys.argv[1:])