Skip to content

Commit 5bda488

Browse files
committed
Use specific python versions
1 parent dd677c3 commit 5bda488

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

build.sbt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ organization := "com.codacy"
2525

2626
val installAll =
2727
s"""apt-get update &&
28-
|apt-get -y install python python3 ca-certificates wget openjdk-8-jre-headless &&
29-
|wget "https://bootstrap.pypa.io/get-pip.py" -O /dev/stdout | python &&
30-
|wget "https://bootstrap.pypa.io/get-pip.py" -O /dev/stdout | python3 &&
31-
|python -m pip install django==1.9.2 pylint-django==0.9.0 flask==0.10.1 pylint-flask==0.1 flask-wtf==0.12 --upgrade --ignore-installed --no-cache-dir &&
32-
|python3 -m pip install django==1.9.2 pylint-django==0.9.0 flask==0.10.1 pylint-flask==0.1 flask-wtf==0.12 --upgrade --ignore-installed --no-cache-dir &&
33-
|python -m pip install pylint-common==0.2.2 &&
34-
|python3 -m pip install pylint-common==0.2.2 &&
35-
|python -m pip install pylint-celery==0.3 &&
36-
|python3 -m pip install pylint-celery==0.3 &&
37-
|python -m pip install SaltPyLint==2017.12.15 &&
38-
|python3 -m pip install SaltPyLint==2017.12.15 &&
39-
|python -m pip install pylint==1.8.2 --upgrade --ignore-installed --no-cache-dir &&
40-
|python3 -m pip install pylint==1.8.2 --upgrade --ignore-installed --no-cache-dir &&
41-
|python -m pip uninstall -y pip &&
42-
|python3 -m pip uninstall -y pip &&
28+
|apt-get -y install python2.7 python3.5 ca-certificates wget openjdk-8-jre-headless &&
29+
|wget "https://bootstrap.pypa.io/get-pip.py" -O /dev/stdout | python2.7 &&
30+
|wget "https://bootstrap.pypa.io/get-pip.py" -O /dev/stdout | python3.5 &&
31+
|python2.7 -m pip install django==1.9.2 pylint-django==0.9.0 flask==0.10.1 pylint-flask==0.1 flask-wtf==0.12 --upgrade --ignore-installed --no-cache-dir &&
32+
|python3.5 -m pip install django==1.9.2 pylint-django==0.9.0 flask==0.10.1 pylint-flask==0.1 flask-wtf==0.12 --upgrade --ignore-installed --no-cache-dir &&
33+
|python2.7 -m pip install pylint-common==0.2.2 &&
34+
|python3.5 -m pip install pylint-common==0.2.2 &&
35+
|python2.7 -m pip install pylint-celery==0.3 &&
36+
|python3.5 -m pip install pylint-celery==0.3 &&
37+
|python2.7 -m pip install SaltPyLint==2017.12.15 &&
38+
|python3.5 -m pip install SaltPyLint==2017.12.15 &&
39+
|python2.7 -m pip install pylint==1.8.2 --upgrade --ignore-installed --no-cache-dir &&
40+
|python3.5 -m pip install pylint==1.8.2 --upgrade --ignore-installed --no-cache-dir &&
41+
|python2.7 -m pip uninstall -y pip &&
42+
|python3.5 -m pip uninstall -y pip &&
4343
|apt-get clean &&
4444
|rm -rf /var/lib/apt/lists/* &&
4545
|rm -rf /root/.cache/pip &&

src/main/scala/codacy/pylint/Pylint.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ object Pylint extends Tool {
145145
def generateClassification(files: List[String]): String = {
146146
val scriptArgs = files.mkString("###")
147147
val tmp = FileHelper.createTmpFile(classifyScript, "pylint", "")
148-
List("python3", tmp.toAbsolutePath.toString, scriptArgs).!!
148+
List("python3.5", tmp.toAbsolutePath.toString, scriptArgs).!!
149149
}
150150

151151
private def classifyFiles(files: List[String]): Try[Map[String, Array[String]]] = {
@@ -183,12 +183,19 @@ object Pylint extends Tool {
183183
val additionalPlugins = django ++ flask
184184

185185
configPart.map { configPart =>
186-
List("python" + interpreter, "-m", "pylint") ++
186+
List("python" + realInterpreterVersion(interpreter), "-m", "pylint") ++
187187
configPart ++ List(s"--msg-template=$msgTemplate", "--output-format=parseable") ++
188188
rulesPart ++ additionalPlugins ++ files
189189
}
190190
}
191191

192+
def realInterpreterVersion(interpreter: String): String = {
193+
interpreter match {
194+
case "2" => "2.7"
195+
case "3" => "3.5"
196+
}
197+
}
198+
192199
private def writeConfigFile(configuration: List[Pattern.Definition]): Try[Path] = {
193200

194201
val parameters = configuration.flatMap { pattern =>

0 commit comments

Comments
 (0)