Tweaks to python build gradle
@@ -6,7 +6,7 @@ import static org.apache.tools.ant.taskdefs.condition.Os.isFamily
task installPipenv {
doLast {
exec {
- commandLine 'pip', 'install', 'pipenv==2018.10.13'
+ commandLine 'pip', 'install', 'pipenv==2018.11.26'
}
}
}
@@ -36,14 +36,13 @@ task pythonVersionInfo {
task installDependencies {
doLast {
exec {
- commandLine 'pipenv', 'install', '--dev', '--python', '3.6'
+ commandLine 'pipenv', 'sync', '--dev', '--python', '3.6'
}
}
}
task preparePythonEnvironment {
dependsOn(installPipenv)
- dependsOn(pythonVersionInfo)
dependsOn(installDependencies)
dependsOn(":keanu-project:preparePythonClasspath")
dependsOn(":codegen:runCodeGeneration")
@@ -101,38 +100,38 @@ task generateDocumentation {
}
}
-def keanuVertexGeneratedPath
-def keanuVertexInitPath
-
-task populateExclusionPaths {
- def keanuVertexPath = Paths.get("keanu", "vertex")
- if(isFamily(FAMILY_WINDOWS)) {
- keanuVertexPath = Paths.get(".").resolve(keanuVertexPath)
- }
- keanuVertexGeneratedPath = keanuVertexPath.resolve("generated.py")
- keanuVertexInitPath = keanuVertexPath.resolve("__init__.py")
-}
+List<String> formatExcludes = [
+ '--exclude', project.file('keanu/vertex/generated.py'),
+ '--exclude', project.file('keanu/vertex/__init__.py'),
+ '--exclude', project.file('build')
+]
task formatApply {
mustRunAfter preparePythonEnvironment // this is a dependency but only needs to be run once
- dependsOn populateExclusionPaths
doLast {
exec {
- commandLine 'pipenv', 'run', 'yapf', '--in-place', '--recursive', '--parallel',
- '--exclude', keanuVertexGeneratedPath, '--exclude', keanuVertexInitPath, '.'
+ commandLine(['pipenv', 'run', 'yapf', '--in-place', '--recursive', '--parallel'].addAll(formatExcludes))
}
}
}
task formatCheck {
mustRunAfter preparePythonEnvironment // this is a dependency but only needs to be run once
- dependsOn populateExclusionPaths
doLast {
exec {
- commandLine 'pipenv', 'run', 'yapf', '--diff', '--recursive', '--parallel',
- '--exclude', keanuVertexGeneratedPath, '--exclude', keanuVertexInitPath, '.'
+ commandLine(['pipenv', 'run', 'yapf', '--diff', '--recursive', '--parallel'].addAll(formatExcludes))
+ }
+ }
+}
+
+task buildBinaryDistribution {
+ mustRunAfter preparePythonEnvironment
+
+ doLast {
+ exec {
+ commandLine 'pipenv', 'run', 'python', project.file("setup.py"), 'bdist'
}
}
}
@@ -141,6 +140,7 @@ pythonVersionInfo.mustRunAfter(installPipenv)
installDependencies.dependsOn(installPipenv)
generateDocumentation.dependsOn(preparePythonEnvironment)
test.dependsOn(preparePythonEnvironment)
-test.dependsOn(formatCheck)
test.dependsOn(pytest)
+check.dependsOn(formatCheck)
+assemble.dependsOn(buildBinaryDistribution)
