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 15:32:02 UTC

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

arpadboda 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_r269623891
 
 

 ##########
 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:
   I'm not really happy with this, as bs4 installation requires pip and I'm not sure we can assume that our users have it.
   I was wondering on adding bs4 as a third party source code, which is not nice, but significantly decreases the dependencies the script have. The rest of the libs used are either available in Python by default or not mandatory.
   
   @apiri , @phrocker what do you think?

----------------------------------------------------------------
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