Skip to content

Commit 1e3507f

Browse files
committed
Cleanup and add an env
1 parent 33594e1 commit 1e3507f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

python/pyspark/install.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ def install_spark(dest, spark_version, hadoop_version, hive_version):
100100

101101
package_name = checked_package_name(spark_version, hadoop_version, hive_version)
102102
package_local_path = os.path.join(dest, "%s.tgz" % package_name)
103-
sites = get_preferred_mirrors()
103+
if "PYSPARK_RELEASE_MIRROR" in os.environ:
104+
sites = [os.environ["PYSPARK_RELEASE_MIRROR"]]
105+
else:
106+
sites = get_preferred_mirrors()
104107
print("Trying to download Spark %s from [%s]" % (spark_version, ", ".join(sites)))
105108

106109
pretty_pkg_name = "%s for Hadoop %s" % (

python/setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ class InstallCommand(install):
120120

121121
def run(self):
122122
install.run(self)
123+
124+
# Make sure the destination is always clean.
125+
spark_dist = os.path.join(self.install_lib, "pyspark", "spark-distribution")
126+
rmtree(spark_dist, ignore_errors=True)
127+
123128
if ("HADOOP_VERSION" in os.environ) or ("HIVE_VERSION" in os.environ):
124129
# Note that SPARK_VERSION environment is just a testing purpose.
125130
spark_version, hadoop_version, hive_version = install_module.checked_versions(
@@ -134,7 +139,7 @@ def run(self):
134139
return
135140

136141
install_module.install_spark(
137-
dest=os.path.join(self.install_lib, "pyspark", "spark-distribution"),
142+
dest=spark_dist,
138143
spark_version=spark_version,
139144
hadoop_version=hadoop_version,
140145
hive_version=hive_version)

0 commit comments

Comments
 (0)