diff --git a/README.win.md b/README.win.md index 6eab53d343c7..293ebdbcc998 100644 --- a/README.win.md +++ b/README.win.md @@ -19,8 +19,11 @@ without fiddling with environment variables. ``` sh # create a new environment with the required packages -conda create -n "matplotlib_build" python=3.4 numpy python-dateutil pyparsing pytz tornado pyqt cycler tk libpng zlib freetype +conda create -n "matplotlib_build" python=3.4 numpy python-dateutil pyparsing pytz tornado "cycler>=0.10" tk libpng zlib freetype activate matplotlib_build +# if you want a qt backend, you also have to install pyqt (be aware that pyqt doesn't mix well if +# you have created the environment with conda-forge already activated...) +conda install pyqt # this package is only available in the conda-forge channel conda install -c conda-forge msinttypes # for python 2.7 diff --git a/appveyor.yml b/appveyor.yml index 1ad753512222..5201af8524f0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,28 +17,36 @@ environment: matrix: # for testing purpose: numpy 1.8 on py2.7, for the rest use 1.10/latest + # theoretically the CONDA_INSTALL_LOCN could be only two: one for 32bit, one for 64bit + # but using one for the right python version is hopefully making it fast due to package caching. - TARGET_ARCH: "x86" CONDA_PY: "27" CONDA_NPY: "18" PYTHON_VERSION: "2.7" + # this variable only influence pdf/svg tests, png tests are run on any platform + # only once, because it basically triples the testing times + # pick the one which seems to make the most problems + TEST_ALL_IMAGES: "yes" CONDA_INSTALL_LOCN: "C:\\Miniconda" - TARGET_ARCH: "x64" CONDA_PY: "27" CONDA_NPY: "18" PYTHON_VERSION: "2.7" + TEST_ALL_IMAGES: "no" CONDA_INSTALL_LOCN: "C:\\Miniconda-x64" - TARGET_ARCH: "x64" CONDA_PY: "34" CONDA_NPY: "110" PYTHON_VERSION: "3.4" + TEST_ALL_IMAGES: "no" CONDA_INSTALL_LOCN: "C:\\Miniconda3-x64" - TARGET_ARCH: "x64" CONDA_PY: "35" CONDA_NPY: "110" PYTHON_VERSION: "3.5" + TEST_ALL_IMAGES: "no" CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64" - # We always use a 64-bit machine, but can build x86 distributions # with the PYTHON_ARCH variable (which is used by CMD_IN_ENV). platform: @@ -53,11 +61,14 @@ init: install: - cmd: set PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\scripts;%PATH%; - cmd: set PYTHONUNBUFFERED=1 - - cmd: conda install -c http://conda.anaconda.org/pelson/channel/development --yes --quiet obvious-ci - - cmd: obvci_install_conda_build_tools.py - - cmd: conda config --set show_channel_urls yes - # for msinttypes + # for obvci_appveyor_python_build_env.cmd + - cmd: conda install -c pelson/channel/development --yes --quiet obvious-ci + # for msinttypes and newer stuff - cmd: conda config --add channels conda-forge + - cmd: conda config --set show_channel_urls yes + - cmd: conda config --set always_yes true + # For building conda packages + - cmd: conda install --yes conda-build jinja2 anaconda-client # this is now the downloaded conda... - conda info -a @@ -68,17 +79,25 @@ install: # VS tools instead of the also installed Py27 VS compiler (which wouldn't need this workarounds...) - cmd: copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat" + # For building, use a new environment which only includes the requirements for mpl # same things as the requirements in ci/conda_recipe/meta.yaml - - cmd: conda create -y -q -n test-environment python=%PYTHON_VERSION% pip setuptools numpy python-dateutil freetype msinttypes tk pyparsing pytz tornado libpng zlib pyqt cycler nose mock msvc_runtime + # if conda-forge gets a new pyqt, it might be nice to install it as well to have more backends + # https://github.com/conda-forge/conda-forge.github.io/issues/157#issuecomment-223536381 + - cmd: conda create -q -n test-environment python=%PYTHON_VERSION% pip setuptools numpy python-dateutil freetype=2.6 msinttypes "tk=8.5" pyparsing pytz tornado "libpng>=1.6.21,<1.7" "zlib=1.2" "cycler>=0.10" nose mock - activate test-environment - cmd: echo %PYTHON_VERSION% %TARGET_ARCH% - - cmd: IF %PYTHON_VERSION% == 2.7 conda install -y functools32 + - cmd: IF %PYTHON_VERSION% == 2.7 conda install -q functools32 # Let the install prefer the static builds of the libs - set LIBRARY_LIB=%CONDA_PREFIX%\Library\lib - cmd: 'mkdir lib || cmd /c "exit /b 0"' - - copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib - - copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib + - copy /Y %LIBRARY_LIB%\zlibstatic.lib lib\z.lib + - copy /Y %LIBRARY_LIB%\libpng_static.lib lib\png.lib + # These z.lib / png.lib are not static versions but files which end up as + # dependencies to the dll file. This is fine for the conda build, but not here + # and for the wheels + - del %LIBRARY_LIB%\png.lib + - del %LIBRARY_LIB%\z.lib - set MPLBASEDIRLIST=%CONDA_PREFIX%\Library\;. # enables the local freetype build - copy ci\travis\setup.cfg . @@ -88,17 +107,42 @@ install: test_script: # Now build the thing.. - '%CMD_IN_ENV% python setup.py develop' + # these should show no z, png, or freetype dll... + - set "DUMPBIN=%VS140COMNTOOLS%\..\..\VC\bin\dumpbin.exe" + #- cmd: '"%DUMPBIN%" /DEPENDENTS lib\matplotlib\_png*.pyd' + #- cmd: '"%DUMPBIN%" /DEPENDENTS lib\matplotlib\ft2font*.pyd' + - cmd: '"%DUMPBIN%" /DEPENDENTS lib\matplotlib\ft2font*.pyd | findstr freetype.*.dll && exit /b 1 || exit /b 0' + - cmd: '"%DUMPBIN%" /DEPENDENTS lib\\matplotlib\\_png*.pyd | findstr z.*.dll && exit /b 1 || exit /b 0' + - cmd: '"%DUMPBIN%" /DEPENDENTS lib\\matplotlib\\_png*.pyd | findstr png.*.dll && exit /b 1 || exit /b 0' + + # this are optional dependencies so that we don't skip so many tests... + - cmd: conda install -q pillow miktex + # autoinstall latex packages (0=no, 1=autoinstall, 2=ask) + # this adds this to the registry! + - cmd: initexmf --set-config-value "[MPM]AutoInstall=1" + # we need to put the real exe files into PATH as subprocess can't call bat files + # this works for the "old" version of the miktex package, then next version should + # not need it + - set "PATH=%PATH%;%CONDA_PREFIX%\Library\miktex\miktex\bin" + # missing packages on conda-forge for ffmpeg avconv mencoder imagemagick inkscape + - cmd: conda install -q -c menpo ffmpeg # a repackaged version + # This install sometimes failed randomly :-( + #- cmd: choco install imagemagick + # only install inkscape during one test run as it increases the runtime of one + # test run from 13 min -> 30 min + - cmd: if x%TEST_ALL_IMAGES% == xyes; choco install inkscape + - cmd: if x%TEST_ALL_IMAGES% == xyes; set "PATH=%PATH%;C:\Program Files\Inkscape\inkscape.com" # Test import of tkagg backend - python -c "import matplotlib as m; m.use('tkagg'); import matplotlib.pyplot as plt; print(plt.get_backend())" # tests - python tests.py - # remove to get around libpng issue? + # Generate a html for visual tests - python visual_tests.py after_test: # After the tests were a success, build packages (wheels and conda) - # Build the wheel + # Build the wheel with the static libs # Hide the output, the copied files really clutter the build log... - cmd: '%CMD_IN_ENV% python setup.py bdist_wheel > NUL:' @@ -112,7 +156,8 @@ after_test: - cmd: path - cmd: where python - cmd: '%CMD_IN_ENV% conda config --get channels' - # - cmd: '%CMD_IN_ENV% conda build .\ci\conda_recipe' + # currently disabled as conda-build errors :-( + #- cmd: '%CMD_IN_ENV% conda build -q .\ci\conda_recipe' # Move the conda package into the dist directory, to register it # as an "artifact" for Appveyor. diff --git a/build_alllocal.cmd b/build_alllocal.cmd index 37560d1830de..9eb9ceadbc68 100644 --- a/build_alllocal.cmd +++ b/build_alllocal.cmd @@ -1,7 +1,9 @@ :: This assumes you have installed all the dependencies via conda packages: :: # create a new environment with the required packages -:: conda create -n "matplotlib_build" python=3.4 numpy python-dateutil pyparsing pytz tornado pyqt cycler tk libpng zlib freetype +:: conda create -n "matplotlib_build" python=3.4 numpy python-dateutil pyparsing pytz tornado "cycler>=0.10" tk libpng zlib freetype :: activate matplotlib_build +:: if you want qt backend, you also have to install pyqt +:: conda install pyqt :: # this package is only available in the conda-forge channel :: conda install -c conda-forge msinttypes :: if you build on py2.7: @@ -15,20 +17,20 @@ IF [%1]==[] ( echo Using user supplied target: %TARGET% ) -IF NOT DEFINED CONDA_DEFAULT_ENV ( +IF NOT DEFINED CONDA_PREFIX ( echo No Conda env activated: you need to create a conda env with the right packages and activate it! GOTO:eof ) :: copy the libs which have "wrong" names -set LIBRARY_LIB=%CONDA_DEFAULT_ENV%\Library\lib +set LIBRARY_LIB=%CONDA_PREFIX%\Library\lib mkdir lib || cmd /c "exit /b 0" copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib :: Make the header files and the rest of the static libs available during the build -:: CONDA_DEFAULT_ENV is a env variable which is set to the currently active environment path -set MPLBASEDIRLIST=%CONDA_DEFAULT_ENV%\Library\;. +:: CONDA_PREFIX is a env variable which is set to the currently active environment path +set MPLBASEDIRLIST=%CONDA_PREFIX%\Library\;. :: build the target python setup.py %TARGET% diff --git a/ci/conda_recipe/bld.bat b/ci/conda_recipe/bld.bat index bd38d0bb3721..a7810d418d2f 100644 --- a/ci/conda_recipe/bld.bat +++ b/ci/conda_recipe/bld.bat @@ -8,5 +8,9 @@ ECHO tests = False >> setup.cfg ECHO sample_data = False >> setup.cfg ECHO toolkits_tests = False >> setup.cfg -%PYTHON% setup.py install +@rem workaround for https://github.com/matplotlib/matplotlib/issues/6460 +@rem see also https://github.com/conda-forge/libpng-feedstock/pull/4 +copy /y %LIBRARY_LIB%\libpng16.lib %LIBRARY_LIB%\png.lib + +%PYTHON% setup.py install --single-version-externally-managed --record=record.txt if errorlevel 1 exit 1 diff --git a/ci/conda_recipe/build.sh b/ci/conda_recipe/build.sh index d4d2f60fab28..c2967acb98cf 100644 --- a/ci/conda_recipe/build.sh +++ b/ci/conda_recipe/build.sh @@ -33,5 +33,5 @@ cat setup.cfg sed -i.bak "s|/usr/local|$PREFIX|" setupext.py -$PYTHON setup.py install +$PYTHON setup.py install --single-version-externally-managed --record=record.txt diff --git a/ci/conda_recipe/condaversion.patch b/ci/conda_recipe/condaversion.patch index c0883d491bca..915fda3bcc23 100644 --- a/ci/conda_recipe/condaversion.patch +++ b/ci/conda_recipe/condaversion.patch @@ -12,3 +12,4 @@ index 8af8b6d..4e4f9d2 100644 # These are the packages in the order we want to display them. This # list may contain strings to create section headers for the display. + \ No newline at end of file diff --git a/ci/conda_recipe/meta.yaml b/ci/conda_recipe/meta.yaml index ab49c6c758db..5f992efff571 100644 --- a/ci/conda_recipe/meta.yaml +++ b/ci/conda_recipe/meta.yaml @@ -3,7 +3,7 @@ package: name: matplotlib - version: 1.5.1.9 + version: 1.9.9 source: path: ../../ @@ -13,50 +13,47 @@ source: - cfg_qt4agg.patch # [linux] # Patches the matplotlibrc template to default to Qt4. - rctmp_pyside.patch # [not osx] - # Patches setupext to look in PREFIX for the tcl/tk headers. - - osx-tk.patch # [osx] # dynamic version from git - # we can't use condas usual dynamic versions as setup.py uses a guard - # around the setup call against importing, which is done internaly - # by conda build to get the version. - # https://github.com/matplotlib/matplotlib/pull/5629#issuecomment-167243654 + # we can't use condas usual dynamic versions as setup.py uses + # multiprocessing during the configure stage and this seems to confuse conda-build. + # https://github.com/conda/conda-build/issues/1061 - condaversion.patch + requirements: build: - python - setuptools + - pkg-config # [not win] - numpy x.x - python-dateutil - - freetype - - msinttypes # [win] - - cycler + - freetype 2.6* + - msinttypes # [win] + - cycler >=0.10 - nose - pyparsing - pytz -# - py2cairo # [linux and py2k] +# - py2cairo # [linux and py2k] - tornado - - libpng - - zlib # [win] - - pyqt # [not osx] - - tk # [linux and win] - - functools32 # [py2k] - - msvc_runtime # [win] + - libpng >=1.6.21,<1.7 + - zlib 1.2* # [win] + - pyqt # [not osx] + - tk 8.5* # [linux] + - functools32 # [py2k] run: - python - numpy x.x - - cycler + - cycler >=0.10 - python-dateutil - - freetype + - freetype 2.6* - pytz - pyparsing -# - py2cairo # [linux and py2k] - - libpng - - pyqt # [not osx] - - tk # [linux and win] - - functools32 # [py2k] - - msvc_runtime # [win] +# - py2cairo # [linux and py2k] + - libpng >=1.6.21,<1.7 + - pyqt # [not osx] + - tk 8.5* # [linux and win] + - functools32 # [py2k] test: imports: @@ -70,6 +67,8 @@ about: extra: recipe-maintainers: + - janschulz # only in the mpl repository + - mdboom # rest form conda-forge + - ocefpaf - pelson - tacaswell - - JanSchulz diff --git a/lib/matplotlib/tests/test_patches.py b/lib/matplotlib/tests/test_patches.py index f844431d58d1..3cd550bd5ea8 100644 --- a/lib/matplotlib/tests/test_patches.py +++ b/lib/matplotlib/tests/test_patches.py @@ -252,8 +252,9 @@ def test_wedge_movement(): assert_equal(getattr(w, attr), new_v) +# png needs tol>=0.06, pdf tol>=1.617 @image_comparison(baseline_images=['wedge_range'], - remove_text=True, tol=0.06 if on_win else 0) + remove_text=True, tol=1.65 if on_win else 0) def test_wedge_range(): ax = plt.axes() diff --git a/patched_bdist_wheel.py b/patched_bdist_wheel.py deleted file mode 100644 index 63fc3ec22d16..000000000000 --- a/patched_bdist_wheel.py +++ /dev/null @@ -1,103 +0,0 @@ -""" -Workaround until https://bitbucket.org/pypa/wheel/issues/91/cannot-create-a-file-when-that-file -is fixed... - -Only one small patch in the os.name == nt case: -- basedir_observed = os.path.join(self.data_dir, '..') -+ basedir_observed = os.path.join(self.data_dir, '..', '.') -""" - -from wheel.bdist_wheel import bdist_wheel -from distutils.sysconfig import get_python_version -from distutils import log as logger -from wheel.archive import archive_wheelfile -import subprocess -import os -from shutil import rmtree - -class patched_bdist_wheel(bdist_wheel): - - def run(self): - build_scripts = self.reinitialize_command('build_scripts') - build_scripts.executable = 'python' - - if not self.skip_build: - self.run_command('build') - - install = self.reinitialize_command('install', - reinit_subcommands=True) - install.root = self.bdist_dir - install.compile = False - install.skip_build = self.skip_build - install.warn_dir = False - - # A wheel without setuptools scripts is more cross-platform. - # Use the (undocumented) `no_ep` option to setuptools' - # install_scripts command to avoid creating entry point scripts. - install_scripts = self.reinitialize_command('install_scripts') - install_scripts.no_ep = True - - # Use a custom scheme for the archive, because we have to decide - # at installation time which scheme to use. - for key in ('headers', 'scripts', 'data', 'purelib', 'platlib'): - setattr(install, - 'install_' + key, - os.path.join(self.data_dir, key)) - - basedir_observed = '' - - if os.name == 'nt': - # win32 barfs if any of these are ''; could be '.'? - # (distutils.command.install:change_roots bug) - # PATCHED... - basedir_observed = os.path.join(self.data_dir, '..', '.') - self.install_libbase = self.install_lib = basedir_observed - - setattr(install, - 'install_purelib' if self.root_is_pure else 'install_platlib', - basedir_observed) - - logger.info("installing to %s", self.bdist_dir) - - self.run_command('install') - - archive_basename = self.get_archive_basename() - - pseudoinstall_root = os.path.join(self.dist_dir, archive_basename) - if not self.relative: - archive_root = self.bdist_dir - else: - archive_root = os.path.join( - self.bdist_dir, - self._ensure_relative(install.install_base)) - - self.set_undefined_options( - 'install_egg_info', ('target', 'egginfo_dir')) - self.distinfo_dir = os.path.join(self.bdist_dir, - '%s.dist-info' % self.wheel_dist_name) - self.egg2dist(self.egginfo_dir, - self.distinfo_dir) - - self.write_wheelfile(self.distinfo_dir) - - self.write_record(self.bdist_dir, self.distinfo_dir) - - # Make the archive - if not os.path.exists(self.dist_dir): - os.makedirs(self.dist_dir) - wheel_name = archive_wheelfile(pseudoinstall_root, archive_root) - - # Sign the archive - if 'WHEEL_TOOL' in os.environ: - subprocess.call([os.environ['WHEEL_TOOL'], 'sign', wheel_name]) - - # Add to 'Distribution.dist_files' so that the "upload" command works - getattr(self.distribution, 'dist_files', []).append( - ('bdist_wheel', get_python_version(), wheel_name)) - - if not self.keep_temp: - if self.dry_run: - logger.info('removing %s', self.bdist_dir) - else: - rmtree(self.bdist_dir) - diff --git a/setup.py b/setup.py index 5612f9d12475..54849dd78a4e 100644 --- a/setup.py +++ b/setup.py @@ -150,20 +150,6 @@ def run(self): cmdclass['test'] = NoopTestCommand cmdclass['build_ext'] = BuildExtraLibraries - -# patch bdist_wheel for a bug on windows -# https://bitbucket.org/pypa/wheel/issues/91/cannot-create-a-file-when-that-file -if os.name == 'nt': - try: - from wheel.bdist_wheel import bdist_wheel - except ImportError: - # No wheel installed, so we also can't run that command... - pass - else: - # patched_bdist_wheel has a run() method, which works on windows - from patched_bdist_wheel import patched_bdist_wheel - cmdclass['bdist_wheel'] = patched_bdist_wheel - # One doesn't normally see `if __name__ == '__main__'` blocks in a setup.py, # however, this is needed on Windows to avoid creating infinite subprocesses # when using multiprocessing.