You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/03/27 16:06:10 UTC

[GitHub] [nifi-minifi-cpp] phrocker commented on a change in pull request #527: MINIFICPP-672 - Bootstrap agent through Python

phrocker commented on a change in pull request #527: MINIFICPP-672 - Bootstrap agent through Python
URL: https://github.com/apache/nifi-minifi-cpp/pull/527#discussion_r269643450
 
 

 ##########
 File path: bootstrap.py
 ##########
 @@ -0,0 +1,298 @@
+#!/usr/bin/python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+MINIFI_SUBFOLDER = '/nifi/nifi-minifi-cpp/'
+APACHE_CLOSER_REPO_JSON_URL = 'https://www.apache.org/dyn/closer.cgi?as_json=1'
+APACHE_MIRROR_LIST = "http://www.apache.org/mirrors/"
+
+import argparse
+import sys
+
+if sys.version_info[0] < 3:
+  raise Exception("Sorry, this script requires Python 3!")
+
+import json
+import os.path
+import platform
+import tarfile
+import requests
+import urllib.request
+
+from distutils.util import strtobool
+from ftplib import FTP
+from urllib.request import urlopen
+
+
+def install_package(package_name):
+  try:
+    import pip
+    if hasattr(pip, 'main'):
+      pipcode = pip.main(['install', package])
+    else:
+      pipcode = pip._internal.main(['install', package])
+    return pipcode == 0
+  except:
+    return False
+
+
+distro_available = False
+
+try:
+  import distro
+
+  distro_available = True
+except:
+  distro_available = install_package("distro")
+
+try:
+  from bs4 import BeautifulSoup
 
 Review comment:
   If you visit a link like this: https://www.apache.org/dyn/closer.cgi?as_json=1&path=/nifi/nifi-minifi-cpp/
   
   You will get the preferred mirror. You can then go to that mirror and list the directories: http://mirrors.sonic.net/apache/nifi/nifi-minifi-cpp/0.6.0 for example. You can probably get the latest release from git and looking at the latest release number if you don't want to introduce a new dependency. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services