You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2021/11/04 08:38:06 UTC

[GitHub] [hadoop] GauthamBanasandra commented on a change in pull request #3535: HADOOP-17880. Build 2.10.x with docker

GauthamBanasandra commented on a change in pull request #3535:
URL: https://github.com/apache/hadoop/pull/3535#discussion_r742627585



##########
File path: dev-support/docker/pkg-resolver/resolve.py
##########
@@ -0,0 +1,61 @@
+#!/usr/bin/env 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.
+
+"""
+Platform package dependency resolver for building Apache Hadoop.
+"""
+
+import json
+import os
+import sys
+from check_platform import is_supported_platform
+
+
+def get_packages(platform):
+    """
+    Resolve and get the list of packages to install for the given platform.
+
+    :param platform: The platform for which the packages needs to be resolved.
+    :return: A list of resolved packages to install.
+    """
+    with open('pkg-resolver/packages.json', mode='rb') as pkg_file:
+        pkgs = json.loads(pkg_file.read().decode("UTF-8"))
+    packages = []
+    for platforms in [x for x in pkgs.values() if x.get(platform) is not None]:
+        if isinstance(platforms.get(platform), list):
+            packages.extend(platforms.get(platform))
+        else:
+            packages.append(platforms.get(platform))
+    return packages
+
+
+if __name__ == '__main__':
+    if len(sys.argv) < 2:
+        sys.stderr.write('ERROR: Need at least 1 argument, {} were provided{}'.format(
+            len(sys.argv) - 1, os.linesep))
+        sys.exit(1)
+
+    PLATFORM_ARG = sys.argv[1]

Review comment:
       @ZhendongBai just a small question if you don't mind - why is this in all caps? Is this a known convention in Python? Could you please change it back to lowercase if it's alright?




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

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org