From db213113f4fccd3e8ea32e1b38e50715e0a52235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Sun, 30 Oct 2016 12:52:25 +0200 Subject: [PATCH] Fix/appveyor all (#1) * Create python-33.yml * Delete python-33.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Use weakref for conflicts caching To prevent GC issues for python <= 3.3, use a weak reference for Index._conflicts * Update index.py * Update appveyor.yml --- appveyor.yml | 30 ++++++++++++++++++++++-------- pygit2/index.py | 10 +++++++--- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f9b7fd0..b6d92c2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,16 +3,29 @@ image: Visual Studio 2015 configuration: Release environment: matrix: - - ARCH: 32 - GENERATOR: 'Visual Studio 11' + - GENERATOR: 'Visual Studio 10' + PYTHON: 'C:\Python27\python.exe' + - GENERATOR: 'Visual Studio 10 Win64' + PYTHON: 'C:\Python27-x64\python.exe' + - GENERATOR: 'Visual Studio 10' + PYTHON: 'C:\Python32\python.exe' + - GENERATOR: 'Visual Studio 10 Win64' + PYTHON: 'C:\Python32-x64\python.exe' + - GENERATOR: 'Visual Studio 10' + PYTHON: 'C:\Python33\python.exe' + - GENERATOR: 'Visual Studio 10 Win64' + PYTHON: 'C:\Python33-x64\python.exe' + - GENERATOR: 'Visual Studio 10' + PYTHON: 'C:\Python34\python.exe' + - GENERATOR: 'Visual Studio 10 Win64' + PYTHON: 'C:\Python34-x64\python.exe' + - GENERATOR: 'Visual Studio 14' PYTHON: 'C:\Python35\python.exe' - PIP: 'C:\Python35\Scripts\pip.exe' - - ARCH: 64 - GENERATOR: 'Visual Studio 11 Win64' + - GENERATOR: 'Visual Studio 14 Win64' PYTHON: 'C:\Python35-x64\python.exe' - PIP: 'C:\Python35-x64\Scripts\pip.exe' + init: -- cmd: '%PIP% install nose wheel' +- cmd: '%PYTHON% -m pip install -U nose wheel' build_script: - cmd: | set LIBGIT2=%APPVEYOR_BUILD_FOLDER%\build\libgit2 @@ -24,8 +37,9 @@ build_script: cmake --build . --config Release --target install cd .. + IF "%GENERATOR%"=="Visual Studio 10 Win64" ( call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" ) + "%PYTHON%" setup.py bdist_wheel - "%PIP%" install . test_script: - ps: | cp build\Release\git2.dll . diff --git a/pygit2/index.py b/pygit2/index.py index d312bb6..f36a0d1 100644 --- a/pygit2/index.py +++ b/pygit2/index.py @@ -28,6 +28,8 @@ # Import from the future from __future__ import absolute_import, unicode_literals +import weakref + # Import from pygit2 from _pygit2 import Oid, Tree, Diff from .errors import check_error @@ -305,10 +307,12 @@ class Index(object): self._conflicts = None return None - if self._conflicts is None: - self._conflicts = ConflictCollection(self) + if self._conflicts is None or self._conflicts() is None: + conflicts = ConflictCollection(self) + self._conflicts = weakref.ref(conflicts) + return conflicts - return self._conflicts + return self._conflicts() class IndexEntry(object):