You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by mnazbro <gi...@git.apache.org> on 2015/12/03 18:49:38 UTC

[GitHub] spark pull request: [SPARK-1267][PYSPARK] Adds pip installer for p...

Github user mnazbro commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8318#discussion_r46585482
  
    --- Diff: python/pyspark/__init__.py ---
    @@ -36,6 +36,53 @@
           Finer-grained cache persistence levels.
     
     """
    +import os
    +import re
    +import sys
    +
    +from os.path import isfile, join
    +
    +import xml.etree.ElementTree as ET
    +
    +if os.environ.get("SPARK_HOME") is None:
    +    raise ImportError("Environment variable SPARK_HOME is undefined.")
    +
    +spark_home = os.environ['SPARK_HOME']
    +pom_xml_file_path = join(spark_home, 'pom.xml')
    +snapshot_version = None
    +
    +if isfile(pom_xml_file_path):
    +    try:
    +        tree = ET.parse(pom_xml_file_path)
    +        root = tree.getroot()
    +        version_tag = root[4].text
    +        snapshot_version = version_tag[:5]
    +    except:
    +        raise ImportError("Could not read the spark version, because pom.xml file" +
    +                          " could not be read.")
    +else:
    +    try:
    +        lib_file_path = join(spark_home, "lib")
    --- End diff --
    
    @alope107 Can we go ahead and find the version only from the spark-assembly jar?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org