summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChih-Hsuan Yen2018-11-27 23:18:14 +0800
committerChih-Hsuan Yen2018-11-27 23:20:10 +0800
commit4ae97fda3f016d4fc5c0489ba88ff12993474152 (patch)
treed6e7e04247c09d35946860df211b0043280e0d8d
parent263f8e7f07da0e35886caeff732e8d3874d9d6ba (diff)
downloadaur-4ae97fda3f016d4fc5c0489ba88ff12993474152.tar.gz
python-torchvision: adopt, fix and improve
-rw-r--r--PKGBUILD39
-rw-r--r--fix-tests.patch29
-rw-r--r--lilac.py10
-rw-r--r--lilac.yaml7
4 files changed, 75 insertions, 10 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 849bb64fede..6e955ac9a79 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,21 +1,40 @@
-# Maintainer: Jean Lucas <jean@4ray.co>
-
-# Based on python-torchvision-git by Stephen Zhang
+# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>
+# Contributor: Jean Lucas <jean@4ray.co>
+# Based on python-torchvision-git; original contributors:
+# Contributor: Stephen Zhang <zsrkmyn at gmail dot com>
pkgname=python-torchvision
pkgver=0.2.1
-pkgrel=1
+pkgrel=2
pkgdesc='Datasets, transforms, and models specific to computer vision'
arch=(any)
url=https://pytorch.org
license=(BSD)
-depends=(python python-pytorch)
+depends=(python-numpy python-pillow python-pytorch python-six)
makedepends=(python-setuptools)
-source=(https://github.com/pytorch/vision/archive/v$pkgver.zip)
-sha512sums=(41fe2ea704cd4d7b43f1043a8666f2d7abd9480519c012321e2f0e3497f2815dc86118c2c57d0cd80f71b6a465521787f4e3c5a423268776009f4069582ab7b4)
+checkdepends=(python-pytest python-scipy)
+source=("torchvision-$pkgver.tar.gz"::"https://github.com/pytorch/vision/archive/v$pkgver.tar.gz"
+ fix-tests.patch::https://github.com/pytorch/vision/commit/4db0398a2b02aae790013efbc868f2d795eb2ef7.patch)
+sha512sums=('224a07c24b2d990a2b396a7d499975347e45eccf501fd75bf528e4d5d92bd4c8f06382b8f3012263378a5e72271d3f9df4bc40248ec7fa218d2913355ed96740'
+ '624bbb9e96ccab3e7884a362015ee7ce159cb24e3fbb1d62575097658f494a7f7c21c511dc4946f808ba42143e9ba7cef9640e6aec234d36a3b48217a69d873c')
+
+prepare() {
+ cd vision-$pkgver
+ patch -Np1 -i ../fix-tests.patch
+}
+
+build() {
+ cd vision-$pkgver
+ python setup.py build
+}
+
+check() {
+ cd vision-$pkgver
+ PYTHONPATH=. pytest -v test
+}
package() {
- cd $srcdir/vision-$pkgver
- python setup.py install --root=$pkgdir --optimize=1
- install -Dm 644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
+ cd vision-$pkgver
+ python setup.py install --root=$pkgdir --optimize=1 --skip-build
+ install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
diff --git a/fix-tests.patch b/fix-tests.patch
new file mode 100644
index 00000000000..8610e2fa896
--- /dev/null
+++ b/fix-tests.patch
@@ -0,0 +1,29 @@
+From 4db0398a2b02aae790013efbc868f2d795eb2ef7 Mon Sep 17 00:00:00 2001
+From: vfdev <vfdev.5@gmail.com>
+Date: Fri, 4 May 2018 22:41:13 +0200
+Subject: [PATCH] Update test_utils.py (#486)
+
+Remove test with variables
+---
+ test/test_utils.py | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/test/test_utils.py b/test/test_utils.py
+index df6ae972..2f8392e0 100644
+--- a/test/test_utils.py
++++ b/test/test_utils.py
+@@ -18,14 +18,6 @@ def test_make_grid_not_inplace(self):
+ utils.make_grid(t, normalize=True, scale_each=True)
+ assert torch.equal(t, t_clone), 'make_grid modified tensor in-place'
+
+- def test_make_grid_raises_with_variable(self):
+- t = torch.autograd.Variable(torch.rand(3, 10, 10))
+- with self.assertRaises(TypeError):
+- utils.make_grid(t)
+-
+- with self.assertRaises(TypeError):
+- utils.make_grid([t, t, t, t])
+-
+
+ if __name__ == '__main__':
+ unittest.main()
diff --git a/lilac.py b/lilac.py
new file mode 100644
index 00000000000..e23c10ef276
--- /dev/null
+++ b/lilac.py
@@ -0,0 +1,10 @@
+from lilaclib import *
+
+
+def pre_build():
+ update_pkgver_and_pkgrel(_G.newver)
+
+
+def post_build():
+ git_pkgbuild_commit()
+ update_aur_repo()
diff --git a/lilac.yaml b/lilac.yaml
new file mode 100644
index 00000000000..58df055893d
--- /dev/null
+++ b/lilac.yaml
@@ -0,0 +1,7 @@
+maintainers:
+ - github: yan12125
+
+build_prefix: extra-x86_64
+
+update_on:
+ - pypi: torchvision