functools32 dependency in installBuildRequirements
umayrh opened this issue · 0 comments
umayrh commented
While trying to upgrade my PyGradle project to python3, I see that the build invariably fails while trying to mysteriously install functools32
. I've already spent weeks try to make PyGradle work with Python 3. Shouldn't it just work out of the box since Py2 is not supported anymore?
> Task :lsystems:installBuildRequirements
Error building package wheel using `[/Users/umayr/Code/sketchy-polytopes/python/lsystems/build/venv/bin/python, /Users/umayr/Code/sketchy-polytopes/python/lsystems/build/venv/bin/pip, wheel, --disable-pip-version-check, --wheel-dir, /Users/umayr/Code/sketchy-polytopes/python/lsystems/build/wheel-cache, --no-deps, /Users/umayr/.gradle/caches/modules-2/files-2.1/pypi/functools32/3.2.3-2/a520082a56af52c7af8d2d1390856bf1a0d755df/functools32-3.2.3-2.tar.gz]`
Processing /Users/umayr/.gradle/caches/modules-2/files-2.1/pypi/functools32/3.2.3-2/a520082a56af52c7af8d2d1390856bf1a0d755df/functools32-3.2.3-2.tar.gz
Complete output from command python setup.py egg_info:
This backport is for Python 2.7 only.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/k6/wgpy0_d135x_8qfrvxr3qf680000gn/T/pip-req-build-p3v1ks18/
Error installing package using `[/Users/umayr/Code/sketchy-polytopes/python/lsystems/build/venv/bin/python, /Users/umayr/Code/sketchy-polytopes/python/lsystems/build/venv/bin/pip, install, --disable-pip-version-check, --no-deps, --upgrade, --ignore-installed, /Users/umayr/.gradle/caches/modules-2/files-2.1/pypi/functools32/3.2.3-2/a520082a56af52c7af8d2d1390856bf1a0d755df/functools32-3.2.3-2.tar.gz]`
Processing /Users/umayr/.gradle/caches/modules-2/files-2.1/pypi/functools32/3.2.3-2/a520082a56af52c7af8d2d1390856bf1a0d755df/functools32-3.2.3-2.tar.gz
Complete output from command python setup.py egg_info:
This backport is for Python 2.7 only.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/k6/wgpy0_d135x_8qfrvxr3qf680000gn/T/pip-req-build-awjoo6f3/
> Task :lsystems:installBuildRequirements FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':lsystems:installBuildRequirements'.
> Failed to install functools32-3.2.3-2. Please see above output for reason, or re-run your build using ``gradle -i build`` for additional logging.
build.gradle:
version = "0.1"
description = "Python Projects"
buildscript {
repositories {
mavenLocal()
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
jcenter()
}
dependencies {
classpath group: 'com.linkedin.pygradle', name: 'pygradle-plugin', version: '0.12.10'
}
}
subprojects {
apply plugin: "idea"
apply plugin: 'com.linkedin.python'
apply plugin: 'com.linkedin.python-sdist'
apply plugin: 'com.linkedin.python-cli'
idea {
module {
sourceDirs += file('src')
testSourceDirs += file('test')
}
}
python {
details {
pythonVersion = '3.7'
details.pythonVersion = '3.7'
}
// Sphinx-1.8.1.dist-info/METADATA:Requires-Dist: enum34; (python_version<"3")
// enum34-1.1.6 causes the build to fail on Python 3. These versions are old but
// the latest ones available at https://linkedin.jfrog.io/linkedin/pypi-external/pypi/
// as of 2020-05-25.
forceVersion('pypi', 'pip3', '21.0.1')
forceVersion('pypi', 'flake8', '3.7.9')
forceVersion('pypi', 'Sphinx', '2.2.1')
}
dependencies {
python ('pypi:flake8:3.7.9') {
exclude module: 'functools32'
}
python ('pypi:matplotlib:3.3.4') {
exclude module: 'functools32'
}
python ('pypi:numpy:1.19.1') {
exclude module: 'functools32'
}
}
repositories {
pyGradlePyPi()
ivy {
// Can't easily use a "global" local repo since
// pivy-importer clobbers pre-existing libraries, which
// could possibly create build problems for other packages
// when builds are running in parallel.
url "build/local-ivy-repo"
layout('pattern') {
ivy "[organisation]/[module]/[revision]/[module]-[revision].ivy"
artifact "[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
m2compatible true
}
}
}
// Workaround due to PyGradle's lack of support for native PyPi repos
task pipInstallRequirements(type: Exec) {
commandLine "bash", "-c", "source build/venv/bin/activate && pip3 install -r requirements.txt && deactivate"
}
task pipInstallRequests(type: Exec) {
commandLine "pip3", "install", "--user", "requests"
}
// TODO: Offline test requires gradle check -x getRequirements since
// we're clobbering the local Ivy repo every time
task getRequirements(type: Exec) {
dependsOn pipInstallRequests
commandLine "python3", "../etc/get_requirements.py", "build/local-ivy-repo"
standardOutput = new ByteArrayOutputStream()
ext.output = {
return standardOutput.toString()
}
}
task printReq {
dependsOn getRequirements
println tasks.getRequirements.output()
}
task printExternalDependencies {
// it would be nice for setup.py to reference these
// dependencies, and, separately, to use `pip freeze`
// to write a requirements.txt
doLast {
println(project.configurations.python.allDependencies)
}
}
installBuildRequirements.dependsOn getRequirements
}