├── .gitignore ├── .gitmodules ├── recipe_templates ├── astroml │ ├── build.sh │ ├── bld.bat │ └── meta.yaml ├── ginga │ ├── bld.bat │ ├── build.sh │ ├── setup.diff │ └── meta.yaml ├── sncosmo │ ├── build.sh │ ├── bld.bat │ └── meta.yaml ├── imexam │ ├── bld.bat │ ├── setup-hack.diff │ ├── build.sh │ └── meta.yaml ├── keyring │ ├── bld.bat │ ├── build.sh │ └── meta.yaml ├── pyregion │ ├── bld.bat │ ├── build.sh │ └── meta.yaml ├── python-cpl │ ├── build.sh │ ├── bld.bat │ └── meta.yaml ├── aplpy │ ├── bld.bat │ ├── build.sh │ └── meta.yaml ├── astropy-helpers │ ├── build.sh │ ├── bld.bat │ └── meta.yaml ├── astroscrappy │ ├── build.sh │ ├── bld.bat │ ├── windows_patch.diff │ └── meta.yaml ├── reproject │ ├── bld.bat │ ├── build.sh │ ├── meta.yaml │ └── windows_patch.diff ├── montage-wrapper │ ├── bld.bat │ ├── build.sh │ └── meta.yaml └── naima │ ├── bld.bat │ ├── build.sh │ └── meta.yaml ├── affiliate-builder ├── build_recipes.py ├── generate_initial_versions.py ├── upload_bdists.py ├── check_build_results.py └── prepare_packages.py ├── LICENSE.rst ├── README.rst ├── appveyor.yml ├── .travis.yml └── requirements.yml /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Obvious-CI"] 2 | path = Obvious-CI 3 | url = https://github.com/pelson/Obvious-CI.git 4 | [submodule "conda-build"] 5 | path = conda-build 6 | url = https://github.com/mwcraig/conda-build.git 7 | -------------------------------------------------------------------------------- /recipe_templates/astroml/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/ginga/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/ginga/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/sncosmo/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/astroml/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/imexam/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/keyring/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/keyring/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/pyregion/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/pyregion/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/python-cpl/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/sncosmo/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/aplpy/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install --offline 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/aplpy/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install --offline 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/astropy-helpers/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/python-cpl/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/astroscrappy/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install --offline 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/reproject/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install --offline 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/reproject/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install --offline 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/astropy-helpers/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install --offline 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/imexam/setup-hack.diff: -------------------------------------------------------------------------------- 1 | --- setup copy.cfg 2015-07-05 13:17:05.000000000 -0500 2 | +++ setup.cfg 2015-07-20 14:56:54.000000000 -0500 3 | @@ -49,7 +49,7 @@ 4 | show-response = 1 5 | 6 | [ah_bootstrap] 7 | -auto_use = True 8 | +auto_use = False 9 | 10 | [egg_info] 11 | tag_build = 12 | -------------------------------------------------------------------------------- /recipe_templates/montage-wrapper/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install --offline 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/montage-wrapper/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install --offline # prevent attempt to update astropy-helpers 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/naima/bld.bat: -------------------------------------------------------------------------------- 1 | "%PYTHON%" setup.py install --offline --single-version-externally-managed --record=junk.txt 2 | if errorlevel 1 exit 1 3 | 4 | :: Add more build steps here, if they are necessary. 5 | 6 | :: See 7 | :: http://docs.continuum.io/conda/build.html 8 | :: for a list of environment variables that are set during the build process. 9 | -------------------------------------------------------------------------------- /recipe_templates/naima/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | $PYTHON setup.py install --offline --single-version-externally-managed --record=junk.txt 4 | 5 | # Add more build steps here, if they are necessary. 6 | 7 | # See 8 | # http://docs.continuum.io/conda/build.html 9 | # for a list of environment variables that are set during the build process. 10 | -------------------------------------------------------------------------------- /recipe_templates/imexam/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Work around this requirement for now... 4 | 5 | pip install d2to1 6 | $PYTHON setup.py install 7 | 8 | # Add more build steps here, if they are necessary. 9 | 10 | # See 11 | # http://docs.continuum.io/conda/build.html 12 | # for a list of environment variables that are set during the build process. 13 | -------------------------------------------------------------------------------- /recipe_templates/ginga/setup.diff: -------------------------------------------------------------------------------- 1 | --- setup copy.py 2015-07-18 13:33:43.000000000 -0500 2 | +++ setup.py 2015-07-18 13:28:47.000000000 -0500 3 | @@ -12,7 +12,7 @@ 4 | from distutils.command.build_py import build_py 5 | 6 | def read(fname): 7 | - buf = open(os.path.join(srcdir, fname), 'r').read() 8 | + buf = open(os.path.join(srcdir, fname), 'r', encoding='utf-8').read() 9 | return buf 10 | 11 | # not yet working... 12 | -------------------------------------------------------------------------------- /affiliate-builder/build_recipes.py: -------------------------------------------------------------------------------- 1 | from __future__ import (division, print_function, absolute_import, 2 | unicode_literals) 3 | 4 | from obvci.conda_tools.build_directory import Builder 5 | from prepare_packages import RECIPE_FOLDER, BINSTAR_CHANNEL 6 | 7 | 8 | def main(recipe_dir=RECIPE_FOLDER): 9 | builder = Builder(recipe_dir, BINSTAR_CHANNEL, 'main') 10 | builder.main() 11 | print('moo') 12 | 13 | 14 | if __name__ == '__main__': 15 | main() 16 | -------------------------------------------------------------------------------- /recipe_templates/astroscrappy/bld.bat: -------------------------------------------------------------------------------- 1 | :: This is painfully ugly, but might make the build succeed on python 2.7 2 | 3 | copy "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include" 4 | 5 | "%PYTHON%" setup.py install --offline 6 | if errorlevel 1 exit 1 7 | 8 | :: Add more build steps here, if they are necessary. 9 | 10 | :: See 11 | :: http://docs.continuum.io/conda/build.html 12 | :: for a list of environment variables that are set during the build process. 13 | -------------------------------------------------------------------------------- /LICENSE.rst: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2015, Astropy Developers 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, this 11 | list of conditions and the following disclaimer in the documentation and/or 12 | other materials provided with the distribution. 13 | * Neither the name of the Astropy Team nor the names of its contributors may be 14 | used to endorse or promote products derived from this software without 15 | specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /recipe_templates/aplpy/meta.yaml: -------------------------------------------------------------------------------- 1 | # matplotlib should be listed as a dependency and it isn't (fails on import without it) 2 | 3 | package: 4 | name: aplpy 5 | version: "{{version}}" 6 | 7 | source: 8 | fn: APLpy-{{version}}.tar.gz 9 | url: https://pypi.python.org/packages/source/A/APLpy/APLpy-{{version}}.tar.gz 10 | md5: {{md5}} 11 | # patches: 12 | # List any patch files here 13 | # - fix.patch 14 | 15 | # build: 16 | # noarch_python: True 17 | # preserve_egg_dir: True 18 | # entry_points: 19 | # Put any entry points (scripts to be generated automatically) here. The 20 | # syntax is module:function. For example 21 | # 22 | # - aplpy = aplpy:main 23 | # 24 | # Would create an entry point called aplpy that calls aplpy.main() 25 | 26 | 27 | # If this is a new build for the same version, increment the build 28 | # number. If you do not include this key, it defaults to 0. 29 | # number: 1 30 | 31 | requirements: 32 | build: 33 | - python 34 | - setuptools 35 | - astropy 36 | 37 | run: 38 | - python 39 | - astropy 40 | - matplotlib 41 | 42 | test: 43 | # Python imports 44 | imports: 45 | - aplpy 46 | - aplpy.tests 47 | 48 | # commands: 49 | # You can put test commands to be run here. Use this to test that the 50 | # entry points work. 51 | 52 | 53 | # You can also put a file called run_test.py in the recipe that will be run 54 | # at test time. 55 | 56 | # requires: 57 | # Put any additional test requirements here. For example 58 | # - nose 59 | 60 | about: 61 | home: http://aplpy.github.io 62 | license: MIT License 63 | summary: 'The Astronomical Plotting Library in Python' 64 | 65 | # See 66 | # http://docs.continuum.io/conda/build.html for 67 | # more information about meta.yaml 68 | -------------------------------------------------------------------------------- /recipe_templates/astroscrappy/windows_patch.diff: -------------------------------------------------------------------------------- 1 | diff --git a/astroscrappy/utils/imutils.h b/astroscrappy/utils/imutils.h 2 | index b4f9ae2..8acf88a 100644 3 | --- astroscrappy/utils/imutils.h 4 | +++ astroscrappy/utils/imutils.h 5 | @@ -10,6 +10,11 @@ 6 | #ifndef IMUTILS_H_ 7 | #define IMUTILS_H_ 8 | 9 | +/* Including definitions of the standard int types is necesssary for Windows, 10 | + * and does no harm on other platforms. 11 | + */ 12 | +#include 13 | + 14 | /* Define a bool type because there isn't one built in ANSI C */ 15 | typedef uint8_t bool; 16 | #define true 1 17 | diff --git a/astroscrappy/utils/medutils.h b/astroscrappy/utils/medutils.h 18 | index 3501636..b7aa72b 100644 19 | --- astroscrappy/utils/medutils.h 20 | +++ astroscrappy/utils/medutils.h 21 | @@ -10,6 +10,11 @@ 22 | #ifndef MEDUTILS_H_ 23 | #define MEDUTILS_H_ 24 | 25 | +/* Including definitions of the standard int types is necesssary for Windows, 26 | + * and does no harm on other platforms. 27 | + */ 28 | +#include 29 | + 30 | /* Define a bool type because there isn't one built in ANSI C */ 31 | typedef uint8_t bool; 32 | #define true 1 33 | diff --git a/astroscrappy/utils/setup_package.py b/astroscrappy/utils/setup_package.py 34 | index b600a5b..457263a 100644 35 | --- astroscrappy/utils/setup_package.py 36 | +++ astroscrappy/utils/setup_package.py 37 | @@ -60,6 +60,10 @@ def get_extensions(): 38 | ext_im.extra_compile_args.append('-fopenmp') 39 | ext_med.extra_link_args = ['-g', '-fopenmp'] 40 | ext_im.extra_link_args = ['-g', '-fopenmp'] 41 | + elif (sys.platform == 'win32' and 42 | + sys.version_info[:2] != (3, 4)): 43 | + ext_med.extra_compile_args.append('-openmp') 44 | + ext_im.extra_compile_args.append('-openmp') 45 | else: 46 | log.warn('OpenMP was not found. ' 47 | 'astroscrappy will be compiled without OpenMP. ' 48 | -------------------------------------------------------------------------------- /recipe_templates/pyregion/meta.yaml: -------------------------------------------------------------------------------- 1 | # CAN BE DELETED AT NEXT pyregion RELEASE. 2 | # Only fix necessary was listing numpy as a dependency. 3 | 4 | package: 5 | name: pyregion 6 | version: "{{version}}" 7 | 8 | source: 9 | fn: pyregion-{{version}}.tar.gz 10 | url: https://pypi.python.org/packages/source/p/pyregion/pyregion-{{version}}.tar.gz 11 | md5: {{md5}} 12 | # patches: 13 | # List any patch files here 14 | # - fix.patch 15 | 16 | # build: 17 | # preserve_egg_dir: True 18 | # entry_points: 19 | # Put any entry points (scripts to be generated automatically) here. The 20 | # syntax is module:function. For example 21 | # 22 | # - pyregion = pyregion:main 23 | # 24 | # Would create an entry point called pyregion that calls pyregion.main() 25 | 26 | 27 | # If this is a new build for the same version, increment the build 28 | # number. If you do not include this key, it defaults to 0. 29 | # number: 1 30 | 31 | requirements: 32 | build: 33 | - python 34 | - setuptools 35 | - pyparsing !=2.0.0 36 | - numpy x.x # pin the numpy version, please... 37 | 38 | run: 39 | - python 40 | - pyparsing !=2.0.0 41 | - numpy x.x # Yes, you need x.x in both places 42 | 43 | test: 44 | # Python imports 45 | imports: 46 | - pyregion 47 | 48 | # commands: 49 | # You can put test commands to be run here. Use this to test that the 50 | # entry points work. 51 | 52 | 53 | # You can also put a file called run_test.py in the recipe that will be run 54 | # at test time. 55 | 56 | # requires: 57 | # Put any additional test requirements here. For example 58 | # - nose 59 | 60 | about: 61 | home: http://leejjoon.github.com/pyregion/ 62 | license: MIT License 63 | summary: 'python parser for ds9 region files' 64 | 65 | # See 66 | # http://docs.continuum.io/conda/build.html for 67 | # more information about meta.yaml 68 | -------------------------------------------------------------------------------- /affiliate-builder/generate_initial_versions.py: -------------------------------------------------------------------------------- 1 | from __future__ import (print_function, division, absolute_import, 2 | unicode_literals) 3 | 4 | from astropy.extern.six.moves.urllib.request import urlopen 5 | import json 6 | import tempfile 7 | import os 8 | import subprocess 9 | from astropy.extern.six.moves import xmlrpc_client as xmlrpclib 10 | 11 | DEFAULT_AFFILIATED_REGISTRY = 'http://affiliated.astropy.org/registry.json' 12 | PYPI_JSON = 'https://pypi.python.org/pypi/{pypi_name}/json' 13 | SKIP_AFFILIATES = ['astropysics'] 14 | PYPI_XMLRPC = 'https://pypi.python.org/pypi' 15 | 16 | 17 | def get_affiliated_packages(): 18 | source = urlopen(DEFAULT_AFFILIATED_REGISTRY) 19 | packages = json.loads(source.read()) 20 | packages = packages['packages'] 21 | return packages 22 | 23 | 24 | def get_pypi_info(name): 25 | client = xmlrpclib.ServerProxy(PYPI_XMLRPC) 26 | print(client.system.listMethods()) 27 | pypi_stable = client.package_releases(name) 28 | print(name, pypi_stable) 29 | try: 30 | return pypi_stable[0] 31 | except IndexError: 32 | return None 33 | 34 | 35 | def build_affiliate_version_dict(): 36 | packages = get_affiliated_packages() 37 | package_names = [p['name'] for p in packages 38 | if p['name'] not in SKIP_AFFILIATES] 39 | print(package_names) 40 | package_version = {} 41 | for package in packages: 42 | name = package['name'] 43 | if name in SKIP_AFFILIATES: 44 | continue 45 | pypi_name = package['pypi_name'] 46 | pypi_info = get_pypi_info(pypi_name) 47 | package_version[pypi_name] = pypi_info 48 | print(package_version) 49 | return package_version 50 | 51 | if __name__ == '__main__': 52 | versions = build_affiliate_version_dict() 53 | with open('requirements.txt', 'wt') as f: 54 | for k, v in versions.items(): 55 | f.write('{}=={}\n'.format(k, v)) 56 | -------------------------------------------------------------------------------- /recipe_templates/astropy-helpers/meta.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: astropy-helpers 3 | version: "{{version}}" 4 | 5 | source: 6 | fn: astropy-helpers-{{version}}.tar.gz 7 | url: https://pypi.python.org/packages/source/a/astropy-helpers/astropy-helpers-{{version}}.tar.gz 8 | md5: {{md5}} 9 | # patches: 10 | # List any patch files here 11 | # - fix.patch 12 | 13 | # build: 14 | # preserve_egg_dir: True 15 | # entry_points: 16 | # Put any entry points (scripts to be generated automatically) here. The 17 | # syntax is module:function. For example 18 | # 19 | # - astropy-helpers = astropy-helpers:main 20 | # 21 | # Would create an entry point called astropy-helpers that calls astropy-helpers.main() 22 | 23 | 24 | # If this is a new build for the same version, increment the build 25 | # number. If you do not include this key, it defaults to 0. 26 | # number: 1 27 | 28 | requirements: 29 | build: 30 | - python 31 | - setuptools 32 | 33 | run: 34 | - python 35 | 36 | test: 37 | # Python imports 38 | imports: 39 | - astropy_helpers 40 | - astropy_helpers.commands 41 | - astropy_helpers.compat 42 | - astropy_helpers.sphinx 43 | ## SKIP these two test to avoid installing sphinx and pytest 44 | # - astropy_helpers.sphinx.ext 45 | # - astropy_helpers.sphinx.ext.tests 46 | 47 | # commands: 48 | # You can put test commands to be run here. Use this to test that the 49 | # entry points work. 50 | 51 | 52 | # You can also put a file called run_test.py in the recipe that will be run 53 | # at test time. 54 | 55 | # requires: 56 | # Put any additional test requirements here. For example 57 | # - nose 58 | 59 | about: 60 | home: http://astropy.org 61 | license: BSD License 62 | summary: 'Utilities for building and installing Astropy, Astropy affiliated packages, and their respective documentation.' 63 | 64 | # See 65 | # http://docs.continuum.io/conda/build.html for 66 | # more information about meta.yaml 67 | -------------------------------------------------------------------------------- /recipe_templates/naima/meta.yaml: -------------------------------------------------------------------------------- 1 | # Recipe needed to build with --single-version-externally-managed to get py3k builds working 2 | package: 3 | name: naima 4 | version: "{{version}}" 5 | 6 | source: 7 | fn: naima-{{version}}.tar.gz 8 | url: https://pypi.python.org/packages/source/n/naima/naima-{{version}}.tar.gz 9 | md5: {{md5}} 10 | # patches: 11 | # List any patch files here 12 | # - fix.patch 13 | 14 | # build: 15 | # noarch_python: True 16 | # preserve_egg_dir: True 17 | # entry_points: 18 | # Put any entry points (scripts to be generated automatically) here. The 19 | # syntax is module:function. For example 20 | # 21 | # - naima = naima:main 22 | # 23 | # Would create an entry point called naima that calls naima.main() 24 | 25 | 26 | # If this is a new build for the same version, increment the build 27 | # number. If you do not include this key, it defaults to 0. 28 | # number: 1 29 | 30 | requirements: 31 | build: 32 | - python 33 | - setuptools 34 | - scipy 35 | - astropy >=1.0.2 36 | - emcee >=2.1.0 37 | - matplotlib 38 | - h5py 39 | 40 | run: 41 | - python 42 | - scipy 43 | - astropy >=1.0.2 44 | - emcee >=2.1.0 45 | - matplotlib 46 | - h5py 47 | 48 | test: 49 | # Python imports 50 | imports: 51 | - naima 52 | - naima.extern 53 | - naima.tests 54 | 55 | # commands: 56 | # You can put test commands to be run here. Use this to test that the 57 | # entry points work. 58 | 59 | 60 | # You can also put a file called run_test.py in the recipe that will be run 61 | # at test time. 62 | 63 | # requires: 64 | # Put any additional test requirements here. For example 65 | # - nose 66 | 67 | about: 68 | home: http://github.com/zblz/naima 69 | license: BSD License 70 | summary: 'Derivation of non-thermal particle distributions through MCMC spectral fitting' 71 | 72 | # See 73 | # http://docs.continuum.io/conda/build.html for 74 | # more information about meta.yaml 75 | -------------------------------------------------------------------------------- /recipe_templates/montage-wrapper/meta.yaml: -------------------------------------------------------------------------------- 1 | # Need recipe because import tests must be skipped...they fail unless montage 2 | # is installed. 3 | # 4 | # Also, astropy is a build requirement but is not listed as such. 5 | 6 | package: 7 | name: montage-wrapper 8 | version: "{{version}}" 9 | 10 | source: 11 | fn: montage-wrapper-{{version}}.tar.gz 12 | url: https://pypi.python.org/packages/source/m/montage-wrapper/montage-wrapper-{{version}}.tar.gz 13 | md5: {{md5}} 14 | # patches: 15 | # List any patch files here 16 | # - fix.patch 17 | 18 | # build: 19 | # preserve_egg_dir: True 20 | # entry_points: 21 | # Put any entry points (scripts to be generated automatically) here. The 22 | # syntax is module:function. For example 23 | # 24 | # - astroml = astroml:main 25 | # 26 | # Would create an entry point called astroml that calls astroml.main() 27 | 28 | 29 | # If this is a new build for the same version, increment the build 30 | # number. If you do not include this key, it defaults to 0. 31 | # number: 1 32 | 33 | requirements: 34 | build: 35 | - python 36 | - astropy # TODO Can be removed in next version of montage-wrapper 37 | 38 | run: 39 | - python 40 | - astropy 41 | 42 | ## SKIP TESTS BECAUSE the only import, of montage-wrapper, will fail if 43 | ## montage is not installed. 44 | 45 | # test: 46 | # # Python imports 47 | # imports: 48 | # - montage_wrapper 49 | 50 | # commands: 51 | # You can put test commands to be run here. Use this to test that the 52 | # entry points work. 53 | 54 | 55 | # You can also put a file called run_test.py in the recipe that will be run 56 | # at test time. 57 | 58 | # requires: 59 | # Put any additional test requirements here. For example 60 | # - nose 61 | 62 | about: 63 | home: http://astropy.org/montage-wrapper/ 64 | license: BSD License 65 | summary: 'Python wrapper for the Montage mosaicking toolkit' 66 | 67 | # See 68 | # http://docs.continuum.io/conda/build.html for 69 | # more information about meta.yaml 70 | -------------------------------------------------------------------------------- /recipe_templates/sncosmo/meta.yaml: -------------------------------------------------------------------------------- 1 | # Recipe is needed because sncosmo does not include astropy_helpers as a submodule, 2 | # so it needs to be listed as a dependency here. 3 | 4 | package: 5 | name: sncosmo 6 | version: "{{version}}" 7 | 8 | source: 9 | fn: sncosmo-{{version}}.tar.gz 10 | url: https://pypi.python.org/packages/source/s/sncosmo/sncosmo-{{version}}.tar.gz 11 | md5: {{md5}} 12 | # patches: 13 | # List any patch files here 14 | # - fix.patch 15 | 16 | # build: 17 | # noarch_python: True 18 | # preserve_egg_dir: True 19 | # entry_points: 20 | # Put any entry points (scripts to be generated automatically) here. The 21 | # syntax is module:function. For example 22 | # 23 | # - sncosmo = sncosmo:main 24 | # 25 | # Would create an entry point called sncosmo that calls sncosmo.main() 26 | 27 | 28 | # If this is a new build for the same version, increment the build 29 | # number. If you do not include this key, it defaults to 0. 30 | # number: 1 31 | 32 | requirements: 33 | build: 34 | - python 35 | - setuptools 36 | - numpy 37 | - scipy 38 | - astropy 39 | - astropy-helpers # If this ever gets submoduled in here this recipe can go 40 | - cython # There is now one cython file included. 41 | 42 | run: 43 | - python 44 | - numpy 45 | - scipy 46 | - astropy 47 | 48 | test: 49 | # Python imports 50 | imports: 51 | - sncosmo 52 | - sncosmo.tests 53 | 54 | # commands: 55 | # You can put test commands to be run here. Use this to test that the 56 | # entry points work. 57 | 58 | 59 | # You can also put a file called run_test.py in the recipe that will be run 60 | # at test time. 61 | 62 | # requires: 63 | # Put any additional test requirements here. For example 64 | # - nose 65 | 66 | about: 67 | home: http://sncosmo.readthedocs.org 68 | license: BSD License 69 | summary: 'Package for supernova cosmology based on astropy' 70 | 71 | # See 72 | # http://docs.continuum.io/conda/build.html for 73 | # more information about meta.yaml 74 | -------------------------------------------------------------------------------- /recipe_templates/reproject/meta.yaml: -------------------------------------------------------------------------------- 1 | # Recipe needed to apply patch on Windows. 2 | # And to include numpy dependency, including pinning the version. 3 | 4 | package: 5 | name: reproject 6 | version: "{{version}}" 7 | 8 | source: 9 | fn: reproject-{{version}}.tar.gz 10 | url: https://pypi.python.org/packages/source/r/reproject/reproject-{{version}}.tar.gz 11 | md5: {{md5}} 12 | patches: 13 | # List any patch files here 14 | - windows_patch.diff [win] 15 | 16 | # build: 17 | # preserve_egg_dir: True 18 | # entry_points: 19 | # Put any entry points (scripts to be generated automatically) here. The 20 | # syntax is module:function. For example 21 | # 22 | # - reproject = reproject:main 23 | # 24 | # Would create an entry point called reproject that calls reproject.main() 25 | 26 | 27 | # If this is a new build for the same version, increment the build 28 | # number. If you do not include this key, it defaults to 0. 29 | # number: 1 30 | 31 | requirements: 32 | build: 33 | - python 34 | - astropy >=1 35 | - numpy x.x 36 | - numpy >=1.9 37 | 38 | run: 39 | - python 40 | - astropy >=1 41 | - scipy 42 | - numpy x.x 43 | - numpy >=1.9 44 | 45 | test: 46 | # Python imports 47 | imports: 48 | - reproject 49 | - reproject.healpix 50 | - reproject.interpolation 51 | - reproject.spherical_intersect 52 | - reproject.tests 53 | - reproject.healpix.tests 54 | - reproject.interpolation.tests 55 | - reproject.spherical_intersect.tests 56 | 57 | # commands: 58 | # You can put test commands to be run here. Use this to test that the 59 | # entry points work. 60 | 61 | 62 | # You can also put a file called run_test.py in the recipe that will be run 63 | # at test time. 64 | 65 | # requires: 66 | # Put any additional test requirements here. For example 67 | # - nose 68 | 69 | about: 70 | home: http://reproject.readthedocs.org 71 | license: BSD License 72 | summary: 'Python-based Astronomical image reprojection' 73 | 74 | # See 75 | # http://docs.continuum.io/conda/build.html for 76 | # more information about meta.yaml 77 | -------------------------------------------------------------------------------- /recipe_templates/python-cpl/meta.yaml: -------------------------------------------------------------------------------- 1 | # Recipe required because astropy not listed in install_requires in version 2 | # 0.7. 3 | # Also, need to exclude windows as a build platform. 4 | package: 5 | name: python-cpl 6 | version: "{{version}}" 7 | 8 | source: 9 | fn: python-cpl-{{version}}.tar.gz 10 | url: https://pypi.python.org/packages/source/p/python-cpl/python-cpl-{{version}}.tar.gz 11 | md5: {{md5}} 12 | # patches: 13 | # List any patch files here 14 | # - fix.patch 15 | 16 | # build: 17 | # noarch_python: True 18 | # preserve_egg_dir: True 19 | # entry_points: 20 | # Put any entry points (scripts to be generated automatically) here. The 21 | # syntax is module:function. For example 22 | # 23 | # - python-cpl = python-cpl:main 24 | # 25 | # Would create an entry point called python-cpl that calls python-cpl.main() 26 | 27 | 28 | # If this is a new build for the same version, increment the build 29 | # number. If you do not include this key, it defaults to 0. 30 | # number: 1 31 | 32 | requirements: 33 | build: 34 | - python 35 | - astropy 36 | 37 | run: 38 | - python 39 | - astropy 40 | 41 | test: 42 | # Python imports 43 | imports: 44 | - cpl 45 | 46 | # commands: 47 | # You can put test commands to be run here. Use this to test that the 48 | # entry points work. 49 | 50 | 51 | # You can also put a file called run_test.py in the recipe that will be run 52 | # at test time. 53 | 54 | # requires: 55 | # Put any additional test requirements here. For example 56 | # - nose 57 | 58 | about: 59 | home: https://pypi.python.org/pypi/python-cpl/0.7 60 | license: GNU General Public License v2 or later (GPLv2+) 61 | summary: 'Python interface for the ESO Common Pipeline Library' 62 | 63 | extra: 64 | # List of platforms on which build of this package is expected to succeed. 65 | # Allowed options are those in binstar subdir: 66 | # osx-64, linux-32, linux-64, win-32, win-64 67 | platforms: 68 | - osx-64 69 | - linux-64 70 | # See 71 | # http://docs.continuum.io/conda/build.html for 72 | # more information about meta.yaml 73 | -------------------------------------------------------------------------------- /recipe_templates/keyring/meta.yaml: -------------------------------------------------------------------------------- 1 | # Recipe template needed for two reasons: 2 | # 3 | # + hgtools is required for build 4 | # + Do not need the test requirements just for testing imports 5 | 6 | package: 7 | name: keyring 8 | version: "{{version}}" 9 | 10 | source: 11 | fn: keyring-{{version}}.zip 12 | url: https://pypi.python.org/packages/source/k/keyring/keyring-{{version}}.zip 13 | md5: {{md5}} 14 | # patches: 15 | # List any patch files here 16 | # - fix.patch 17 | 18 | build: 19 | # noarch_python: True 20 | # preserve_egg_dir: True 21 | entry_points: 22 | # Put any entry points (scripts to be generated automatically) here. The 23 | # syntax is module:function. For example 24 | # 25 | # - keyring = keyring:main 26 | # 27 | # Would create an entry point called keyring that calls keyring.main() 28 | 29 | - keyring=keyring.cli:main 30 | 31 | # If this is a new build for the same version, increment the build 32 | # number. If you do not include this key, it defaults to 0. 33 | # number: 1 34 | 35 | requirements: 36 | build: 37 | - python 38 | - setuptools 39 | - hgtools # skeleton does not catch this 40 | 41 | run: 42 | - python 43 | 44 | test: 45 | # Python imports 46 | imports: 47 | - keyring 48 | - keyring.backends 49 | - keyring.tests 50 | - keyring.tests.backends 51 | - keyring.util 52 | 53 | commands: 54 | # You can put test commands to be run here. Use this to test that the 55 | # entry points work. 56 | 57 | - keyring --help 58 | 59 | # You can also put a file called run_test.py in the recipe that will be run 60 | # at test time. 61 | 62 | requires: 63 | # Do not need the packages below just for testing imports 64 | # - fs >=0.5 65 | # - gdata 66 | # - mock 67 | # - pycrypto 68 | # - pytest 69 | # - python-keyczar 70 | 71 | about: 72 | home: http://bitbucket.org/kang/python-keyring-lib 73 | license: Python Software Foundation License or MIT License 74 | summary: 'Store and access your passwords safely.' 75 | 76 | # See 77 | # http://docs.continuum.io/conda/build.html for 78 | # more information about meta.yaml 79 | -------------------------------------------------------------------------------- /recipe_templates/reproject/windows_patch.diff: -------------------------------------------------------------------------------- 1 | diff --git a/reproject/spherical_intersect/mNaN.h b/reproject/spherical_intersect/mNaN.h 2 | index f8cd61f..3638736 100644 3 | --- reproject/spherical_intersect/mNaN.h 4 | +++ reproject/spherical_intersect/mNaN.h 5 | @@ -4,4 +4,4 @@ 6 | 7 | #include 8 | 9 | -#define mNaN(x) isnan(x) || !finite(x) 10 | +#define mNaN(x) _isnan(x) || !_finite(x) 11 | diff --git a/reproject/spherical_intersect/overlapArea.c b/reproject/spherical_intersect/overlapArea.c 12 | index 56c7987..ac7061d 100644 13 | --- reproject/spherical_intersect/overlapArea.c 14 | +++ reproject/spherical_intersect/overlapArea.c 15 | @@ -4,6 +4,7 @@ 16 | */ 17 | 18 | #include 19 | +#define _USE_MATH_DEFINES 20 | #include 21 | #include "mNaN.h" 22 | #include "overlapArea.h" 23 | diff --git a/reproject/spherical_intersect/reproject_slice_c.c b/reproject/spherical_intersect/reproject_slice_c.c 24 | index 424bb86..a2c45f7 100644 25 | --- reproject/spherical_intersect/reproject_slice_c.c 26 | +++ reproject/spherical_intersect/reproject_slice_c.c 27 | @@ -1,7 +1,7 @@ 28 | #include "overlapArea.h" 29 | #include "reproject_slice_c.h" 30 | 31 | -static inline double min_4(const double *ptr) 32 | +static _inline double min_4(const double *ptr) 33 | { 34 | double retval = ptr[0]; 35 | int i; 36 | @@ -13,7 +13,7 @@ static inline double min_4(const double *ptr) 37 | return retval; 38 | } 39 | 40 | -static inline double max_4(const double *ptr) 41 | +static _inline double max_4(const double *ptr) 42 | { 43 | double retval = ptr[0]; 44 | int i; 45 | @@ -25,13 +25,13 @@ static inline double max_4(const double *ptr) 46 | return retval; 47 | } 48 | 49 | -static inline double to_rad(double x) 50 | +static _inline double to_rad(double x) 51 | { 52 | return x * 0.017453292519943295; 53 | } 54 | 55 | // Kernel for overlap computation. 56 | -static inline void _compute_overlap(double *overlap, 57 | +static _inline void _compute_overlap(double *overlap, 58 | double *area_ratio, 59 | double *ilon, 60 | double *ilat, 61 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Purpose 2 | ======= 3 | 4 | This builder-bot makes `conda`_ packages for `astropy`_ affiliated packages. 5 | 6 | Design decisions 7 | ================ 8 | 9 | + `conda`_ packages will be made only for non-dev versions of affiliated 10 | packages. 11 | + A dev version is any version whose name contains letters (this is broader 12 | than `PEP 440`_ but avoids the need for any intelligent parsing). 13 | + `conda`_ recipes are avoided wherever possible to avoid duplicating 14 | information already in the ``setup.py`` of most affiliated packages. 15 | + Where possible, python scripts are used to do the work to avoid separate 16 | Linux/Mac and Windows scripts. 17 | 18 | Maintaining the bot 19 | =================== 20 | 21 | Update version of existing package 22 | ---------------------------------- 23 | 24 | Open a pull request that updates the version number of the package(s) to be 25 | built. Doing so will trigger builds of the new package(s) on all platforms. 26 | Packages are automatically upload to the `astropy binstar channel`_. 27 | 28 | Add a new affiliated package 29 | ---------------------------- 30 | 31 | 1. Figure out how to build the `conda`_ package. 32 | + First try ``python setup.py bdist_conda``. 33 | + If that fails, try to convince the package maintainer to update 34 | their ``setup.py`` so that this works. 35 | + If that fails, try ``conda skeleton pypi packagename`` to generate 36 | the initial recipe and modify as needed until 37 | ``conda build packagename`` works. 38 | 2. If ``python setup.py bdist_conda`` works you only need to open a pull 39 | request on this repo that adds the package and version to 40 | ``requirements.txt``. 41 | 3. If the package needs a recipe to build you need to open a pull request that: 42 | + Adds the package information to ``requirements.txt`` 43 | + Adds a template recipe for the package to ``recipe-templates``. 44 | 45 | License 46 | ======= 47 | 48 | This software is licensed under a BSD 3-clause license. See ``LICENSE.rst`` for details. 49 | 50 | .. _astropy: http://astropy.org 51 | .. _conda: http://conda.pydata.org/ 52 | .. _PEP 440: https://www.python.org/dev/peps/pep-0440/ 53 | .. _astropy binstar channel: http://binstar.org/astropy 54 | -------------------------------------------------------------------------------- /recipe_templates/astroscrappy/meta.yaml: -------------------------------------------------------------------------------- 1 | # Needs recipe template to: 2 | # 3 | # + Add astropy, numpy, cython as dependencies. 4 | # + Add numpy x.x to pin numpy version. 5 | # + Remove a test and a build instruction for creating an entry point left 6 | # over from the package template. 7 | package: 8 | name: astroscrappy 9 | version: "{{version}}" 10 | 11 | source: 12 | fn: astroscrappy-{{version}}.tar.gz 13 | url: https://pypi.python.org/packages/source/a/astroscrappy/astroscrappy-{{version}}.tar.gz 14 | md5: {{md5}} 15 | patches: 16 | # List any patch files here 17 | - windows_patch.diff [win] 18 | 19 | build: 20 | # noarch_python: True 21 | # preserve_egg_dir: True 22 | entry_points: 23 | # Put any entry points (scripts to be generated automatically) here. The 24 | # syntax is module:function. For example 25 | # 26 | # - astroscrappy = astroscrappy:main 27 | # 28 | # Would create an entry point called astroscrappy that calls astroscrappy.main() 29 | 30 | # - astropy-package-template-example = packagename.example_mod:main 31 | 32 | # If this is a new build for the same version, increment the build 33 | # number. If you do not include this key, it defaults to 0. 34 | # number: 1 35 | 36 | requirements: 37 | build: 38 | - python 39 | - setuptools 40 | - astropy 41 | - cython 42 | - numpy x.x 43 | - numpy >=1.9 44 | 45 | run: 46 | - python 47 | - astropy 48 | - numpy x.x 49 | - numpy >=1.9 50 | 51 | test: 52 | # Python imports 53 | imports: 54 | - astroscrappy 55 | - astroscrappy.tests 56 | - astroscrappy.utils 57 | 58 | commands: 59 | # You can put test commands to be run here. Use this to test that the 60 | # entry points work. 61 | 62 | # - astropy-package-template-example --help 63 | 64 | # You can also put a file called run_test.py in the recipe that will be run 65 | # at test time. 66 | 67 | # requires: 68 | # Put any additional test requirements here. For example 69 | # - nose 70 | 71 | about: 72 | home: https://github.com/astropy/astroscrappy 73 | license: BSD 74 | summary: 'Speedy Cosmic Ray Annihilation Package in Python' 75 | 76 | # See 77 | # http://docs.continuum.io/conda/build.html for 78 | # more information about meta.yaml 79 | -------------------------------------------------------------------------------- /recipe_templates/ginga/meta.yaml: -------------------------------------------------------------------------------- 1 | # Need recipe to patch on Windows + python 3 2 | 3 | package: 4 | name: ginga 5 | version: "{{version}}" 6 | 7 | source: 8 | fn: ginga-{{version}}.tar.gz 9 | url: https://pypi.python.org/packages/source/g/ginga/ginga-{{version}}.tar.gz 10 | md5: {{md5}} 11 | patches: 12 | # List any patch files here 13 | - setup.diff # [win and py3k] 14 | 15 | # build: 16 | # noarch_python: True 17 | # preserve_egg_dir: True 18 | # entry_points: 19 | # Put any entry points (scripts to be generated automatically) here. The 20 | # syntax is module:function. For example 21 | # 22 | # - ginga = ginga:main 23 | # 24 | # Would create an entry point called ginga that calls ginga.main() 25 | 26 | 27 | # If this is a new build for the same version, increment the build 28 | # number. If you do not include this key, it defaults to 0. 29 | # number: 1 30 | 31 | requirements: 32 | build: 33 | - python 34 | - python >2.6 35 | - setuptools 36 | - numpy >=1.7 37 | 38 | run: 39 | - python 40 | - python >2.6 41 | - numpy >=1.7 42 | 43 | test: 44 | # Python imports 45 | imports: 46 | - ginga 47 | - ginga.aggw 48 | - ginga.base 49 | - ginga.cairow 50 | - ginga.canvas 51 | - ginga.cvw 52 | - ginga.doc 53 | - ginga.gtkw 54 | - ginga.gtkw.plugins 55 | - ginga.gtkw.tests 56 | - ginga.icons 57 | - ginga.misc 58 | - ginga.misc.plugins 59 | - ginga.mockw 60 | - ginga.mplw 61 | - ginga.qtw 62 | - ginga.qtw.plugins 63 | - ginga.qtw.tests 64 | - ginga.tests 65 | - ginga.tkw 66 | - ginga.util 67 | - ginga.web 68 | - ginga.web.pgw 69 | - ginga.web.pgw.js 70 | - ginga.web.pgw.templates 71 | 72 | # commands: 73 | # You can put test commands to be run here. Use this to test that the 74 | # entry points work. 75 | 76 | 77 | # You can also put a file called run_test.py in the recipe that will be run 78 | # at test time. 79 | 80 | # requires: 81 | # Put any additional test requirements here. For example 82 | # - nose 83 | 84 | about: 85 | home: http://ejeschke.github.com/ginga 86 | license: BSD License 87 | summary: 'An astronomical image viewer and toolkit.' 88 | 89 | # See 90 | # http://docs.continuum.io/conda/build.html for 91 | # more information about meta.yaml 92 | -------------------------------------------------------------------------------- /affiliate-builder/upload_bdists.py: -------------------------------------------------------------------------------- 1 | from __future__ import (division, print_function, absolute_import, 2 | unicode_literals) 3 | 4 | import os 5 | import glob 6 | 7 | from conda import config 8 | import binstar_client 9 | 10 | from obvci.conda_tools.build import upload 11 | from obvci.conda_tools.build_directory import Builder 12 | 13 | from prepare_packages import RECIPE_FOLDER, BINSTAR_CHANNEL, BDIST_CONDA_FOLDER 14 | 15 | 16 | def main(): 17 | # Get our binstar client from the Builder to get BINSTAR_TOKEN obfuscation 18 | # in windows builds. 19 | builder = Builder(RECIPE_FOLDER, BINSTAR_CHANNEL, 'main') 20 | try: 21 | bdists = os.listdir(BDIST_CONDA_FOLDER) 22 | except (OSError): 23 | # Nothing to upload. 24 | return 25 | 26 | conda_builds_dir = os.path.join(config.default_prefix, 27 | 'conda-bld', config.subdir) 28 | built_packages = glob.glob(os.path.join(conda_builds_dir, '*.tar.bz2')) 29 | for package in built_packages: 30 | _, package_file = os.path.split(package) 31 | # Work around packages having a hypen in their name 32 | name = package_file.split('-') 33 | name.pop(-1) 34 | name.pop(-1) 35 | name = "-".join(name) 36 | if name in bdists: 37 | # Need to upload this one... 38 | # First grab the metadata from the package, which requires 39 | # opening the file. 40 | 41 | # Not going to lie: after fighting with conda for 90 minutes to 42 | # construct a proper MetaData object from a built package, I give 43 | # up. 44 | 45 | # Instead, create an object with one method, dist, which returns 46 | # the build string and be done with it. 47 | class MetaData(object): 48 | def __init__(self, dist_info): 49 | self._dist_info = dist_info 50 | 51 | def dist(self): 52 | return self._dist_info 53 | 54 | meta = MetaData(package_file.split('.tar.bz2')[0]) 55 | 56 | try: 57 | # Upload it 58 | upload(builder.binstar_cli, meta, BINSTAR_CHANNEL) 59 | except binstar_client.errors.Unauthorized: 60 | print("Not authorized to upload.") 61 | 62 | 63 | if __name__ == '__main__': 64 | main() 65 | -------------------------------------------------------------------------------- /recipe_templates/astroml/meta.yaml: -------------------------------------------------------------------------------- 1 | # astroml has no dependencies listed in setup.py, so need recipe. 2 | 3 | package: 4 | name: astroml 5 | version: "{{version}}" 6 | 7 | source: 8 | fn: astroML-{{version}}.tar.gz 9 | url: https://pypi.python.org/packages/source/a/astroML/astroML-{{version}}.tar.gz 10 | md5: {{md5}} 11 | # patches: 12 | # List any patch files here 13 | # - fix.patch 14 | 15 | # build: 16 | # preserve_egg_dir: True 17 | # entry_points: 18 | # Put any entry points (scripts to be generated automatically) here. The 19 | # syntax is module:function. For example 20 | # 21 | # - astroml = astroml:main 22 | # 23 | # Would create an entry point called astroml that calls astroml.main() 24 | 25 | 26 | # If this is a new build for the same version, increment the build 27 | # number. If you do not include this key, it defaults to 0. 28 | # number: 1 29 | 30 | requirements: 31 | build: 32 | - python 33 | - python >=2.6|>=3.3 34 | 35 | run: 36 | - python 37 | - python >=2.6|>=3.3 38 | - numpy >=1.4 39 | - scipy >=0.7 40 | - matplotlib >=0.99 41 | - scikit-learn >=0.10 42 | - astropy >=0.2.5 43 | 44 | test: 45 | # Python imports 46 | imports: 47 | - astroML 48 | - astroML.classification 49 | - astroML.clustering 50 | - astroML.clustering.tests 51 | - astroML.datasets 52 | - astroML.datasets.tools 53 | - astroML.density_estimation 54 | - astroML.density_estimation.tests 55 | - astroML.dimensionality 56 | - astroML.dimensionality.tests 57 | - astroML.linear_model 58 | - astroML.plotting 59 | - astroML.plotting.tests 60 | - astroML.stats 61 | - astroML.stats.tests 62 | - astroML.tests 63 | - astroML.time_series 64 | - astroML.time_series.tests 65 | - astroML 66 | 67 | # commands: 68 | # You can put test commands to be run here. Use this to test that the 69 | # entry points work. 70 | 71 | 72 | # You can also put a file called run_test.py in the recipe that will be run 73 | # at test time. 74 | 75 | # requires: 76 | # Put any additional test requirements here. For example 77 | # - nose 78 | 79 | about: 80 | home: http://astroML.github.com 81 | license: BSD License 82 | summary: 'tools for machine learning and data mining in Astronomy' 83 | 84 | # See 85 | # http://docs.continuum.io/conda/build.html for 86 | # more information about meta.yaml 87 | -------------------------------------------------------------------------------- /recipe_templates/imexam/meta.yaml: -------------------------------------------------------------------------------- 1 | # Need recipe because astropy-helpers is not included as submodule and need 2 | # to patch setup configuration to avoid trying to update astropy-helpers 3 | 4 | package: 5 | name: imexam 6 | version: "{{version}}" 7 | 8 | source: 9 | fn: imexam-{{version}}.tar.gz 10 | url: https://pypi.python.org/packages/source/i/imexam/imexam-{{version}}.tar.gz 11 | md5: {{md5}} 12 | patches: 13 | - setup-hack.diff 14 | # patches: 15 | # List any patch files here 16 | # - fix.patch 17 | 18 | # build: 19 | # preserve_egg_dir: True 20 | # entry_points: 21 | # Put any entry points (scripts to be generated automatically) here. The 22 | # syntax is module:function. For example 23 | # 24 | # - sncosmo = sncosmo:main 25 | # 26 | # Would create an entry point called sncosmo that calls sncosmo.main() 27 | 28 | # If this is a new build for the same version, increment the build 29 | # number. If you do not include this key, it defaults to 0. 30 | # number: 1 31 | 32 | requirements: 33 | build: 34 | - astropy-helpers 35 | - astropy 36 | - numpy >=1.6.0 37 | - scipy 38 | - cython 39 | - astropy >=1.0 40 | - matplotlib 41 | - ipython 42 | - python 43 | - python >2.6,<3 44 | - mock 45 | - nose 46 | run: 47 | - astropy 48 | - numpy >=1.6.0 49 | - scipy 50 | - cython 51 | - astropy >=1.0 52 | - matplotlib 53 | - ipython 54 | - python 55 | - python >2.6,<3 56 | 57 | test: 58 | # Python imports 59 | imports: 60 | - imexam 61 | 62 | # commands: 63 | # You can put test commands to be run here. Use this to test that the 64 | # entry points work. 65 | 66 | 67 | # You can also put a file called run_test.py in the recipe that will be run 68 | # at test time. 69 | 70 | # requires: 71 | # Put any additional test requirements here. For example 72 | # - nose 73 | 74 | about: 75 | home: http://imexam.readthedocs.org 76 | license: BSD License 77 | summary: 'AstroPy affiliated package for quick image analysis' 78 | 79 | extra: 80 | # List of platforms on which build of this package is expected to succeed. 81 | # Allowed options are those in binstar subdir: 82 | # osx-64, linux-32, linux-64, win-32, win-64 83 | platforms: 84 | - osx-64 85 | - linux-64 86 | # List of python versions (in CONDA_PY format) for which this package 87 | # should be built. 88 | # pythons: 89 | # - 27 90 | -------------------------------------------------------------------------------- /affiliate-builder/check_build_results.py: -------------------------------------------------------------------------------- 1 | from __future__ import (division, print_function, absolute_import, 2 | unicode_literals) 3 | 4 | import os 5 | 6 | import conda_build.config as config 7 | from prepare_packages import RECIPE_FOLDER, BINSTAR_CHANNEL, BDIST_CONDA_FOLDER 8 | 9 | 10 | def package_in_list(package_name, package_list): 11 | """ 12 | Iterate through list of packages, returning True if the package is in 13 | the list and False otherwise. 14 | 15 | Parameters 16 | ---------- 17 | 18 | package_name : str 19 | Name of package. 20 | package_list : list 21 | List of package names. 22 | 23 | Returns 24 | ------- 25 | 26 | bool 27 | ``True`` if there is a package in the list whose name starts with 28 | ``package_name``, ``False`` otherwise. 29 | """ 30 | for p in package_list: 31 | if p.startswith(package_name): 32 | return True 33 | else: 34 | return False 35 | 36 | 37 | def main(recipe_dir, bdist_conda_dir): 38 | """ 39 | Check, for each package that was to have been built, whether the 40 | package was actually built. 41 | 42 | The check is fairly simple: every package in 43 | the recipe or bdist_conda directory should have a corresponding conda 44 | package. If it doesn't, declare failure and move on. 45 | 46 | Parameters 47 | ---------- 48 | 49 | recipe_dir : str 50 | Directory which, if it exists, has a subdirectory for each package to 51 | be built with ``conda build``. 52 | bdist_conda_dir : str 53 | Directory which, if it exists, has a subdirectory for each package to 54 | be built with ``setup.py bdist_conda`` 55 | """ 56 | try: 57 | built_packages = os.listdir(config.config.bldpkgs_dir) 58 | except OSError: 59 | # No packages were built. 60 | built_packages = [] 61 | 62 | try: 63 | recipes = os.listdir(recipe_dir) 64 | except OSError: 65 | recipes = [] 66 | 67 | try: 68 | bdist_conda = os.listdir(bdist_conda_dir) 69 | except OSError: 70 | bdist_conda = [] 71 | 72 | expected_packages = recipes + bdist_conda 73 | 74 | not_built = [package for package in expected_packages 75 | if not package_in_list(package, built_packages)] 76 | 77 | if not_built: 78 | raise RuntimeError("The following packages were not built:\n" 79 | "{}".format('\n'.join(not_built))) 80 | 81 | 82 | if __name__ == '__main__': 83 | main(RECIPE_FOLDER, BDIST_CONDA_FOLDER) 84 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | environment: 2 | CONDA_INSTALL_LOCN: "C:\\conda" 3 | CMD_IN_ENV: cmd /E:ON /V:ON /C Obvious-CI\scripts\obvci_appveyor_python_build_env.cmd 4 | CONDA_BUILD_VERSION: "1.16.0" 5 | BUILDER_PYTHON_VERSION: "2" 6 | # Python version restrictions that should apply to all builds regardless 7 | # of any package-specific version restrictions 8 | PYTHON_BUILD_RESTRICTIONS: "2.7*|>=3.4" 9 | 10 | BINSTAR_TOKEN: 11 | secure: eNFZ6uLsFUgtwjXf6n/vayT97T4sSX1nG3iv8Hfp2vWKIZJIQ6jmCeL/agYmnbiX 12 | 13 | matrix: 14 | # Unfortunately, compiler/SDK configuration for 64 bit builds depends on 15 | # python version. Right now conda build does not configure the SDK, and 16 | # the appveyor setup only sets up the SDK once, so separate by python 17 | # versions. 18 | - TARGET_ARCH: "x64" 19 | PYTHON_BUILD_RESTRICTIONS: "2.7*" 20 | CONDA_PY: "27" 21 | - TARGET_ARCH: "x64" 22 | PYTHON_BUILD_RESTRICTIONS: "3.4*" 23 | CONDA_PY: "34" 24 | - TARGET_ARCH: "x64" 25 | PYTHON_BUILD_RESTRICTIONS: "3.5*" 26 | CONDA_PY: "35" 27 | # For 32 bit builds there are no compiler issues, let Obvious-CI 28 | # handle the matrix 29 | # - TARGET_ARCH: "x86" 30 | # PYTHON_BUILD_RESTRICTIONS: "2.7*|>=3.4" 31 | 32 | # We always use a 64-bit machine, but can build x86 distributions 33 | # with the TARGET_ARCH variable. 34 | platform: 35 | - x64 36 | 37 | install: 38 | - cmd: git submodule update --init --recursive 39 | - cmd: python Obvious-CI\bootstrap-obvious-ci-and-miniconda.py %CONDA_INSTALL_LOCN% %TARGET_ARCH% %BUILDER_PYTHON_VERSION% --without-obvci --miniconda-version latest 40 | - cmd: SET PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\Scripts;%PATH% 41 | 42 | - cmd: conda config --set always_yes true 43 | - cmd: conda update --quiet conda 44 | - cmd: conda config --add channels astropy 45 | - cmd: conda install --quiet astropy anaconda-client jinja2 cython 46 | # These installs are needed on windows but not other platforms. 47 | - cmd: conda install patch psutil 48 | # Install custom version of conda-build for now (need to be able to pass 49 | # options to setup.py) 50 | # Instead of building from source -- which does not seem to create 51 | # the scripts necessary to run conda skeleton -- there is a package 52 | # on astropy-ci-extras. 53 | - cmd: conda install -c astropy-ci-extras conda-build=1.18.1 54 | # Install obvious-ci; run 2to3 first if the build is done on python 3. 55 | - cmd: cd Obvious-CI & (if %BUILDER_PYTHON_VERSION%==3 2to3 -w .) & python setup.py install & cd .. 56 | 57 | # Skip .NET project specific build phase. 58 | build: off 59 | 60 | test_script: 61 | - "%CMD_IN_ENV% python affiliate-builder\\prepare_packages.py requirements.yml" 62 | - if exist recipes %CMD_IN_ENV% obvci_conda_build_dir --build-condition="python %PYTHON_BUILD_RESTRICTIONS%" recipes astropy 63 | # Right now fails happen immediately on trying to build. 64 | # - python affiliate-builder\\check_build_results.py 65 | 66 | # Upload now occurs immediately after recipe is built. 67 | # on_success: 68 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # The language in this case has no bearing - we are going to be making use of "conda" for a 2 | # python distribution for the scientific python stack. 3 | language: c 4 | 5 | os: 6 | - linux 7 | - osx 8 | 9 | env: 10 | global: 11 | - TARGET_ARCH="x64" 12 | - CONDA_INSTALL_LOCN="${HOME}/conda" 13 | # Defines BINSTAR_TOKEN for astropy binstar channel 14 | - secure: "c/MXanxumEXl7l3vXv4Bx5cCm9RBvz4bBDrAbzSf9SjqS5Xq5Fv0jbetExNKzgjKzGQ3rv8HYhpOeVabNxHEmqqI8rOl79J/L1ba0XClTIBbkeO/rM2HS0LuS95FSvx4+eeAm6m+5xVBAJW3EXVssRt56T3y69JJD0+2pEtbUCT7I88fnb1llWRcnJsZh5sB8qppklYIc1qxofcw8EiCIBwY1wHGwQ/Jq4n6VutAjEnIUaK6cX7XuO8mvyhYEcg2gww4qcSiMkb/8KcXl9t8fSshLC1tNTwLhmA4dUo0Dbgow0xtUNqzy3L/TEWhfj9hBhGijexhMSrLwMTAEgIxPNiAsrHv3EOgX2sd/UXQo+vZ96V35apfRzJrojtGQhgIEUc36tCNfH3GcnX7jWZfaPySqohZAsj/RFrFPVkhW64VcdCAyhHc3UBTy3odmiiMYkln+cXJ/G3+CENDNeR/5uwKYQ1Ez79J1KrBIXrRYBsEAR6VCbRZ/mu/ea7cSzLeo9lIu4uyiLhLLvCua4U0/YkTJFebdpR+YNDyNVNuYVXU3XQCHRhi5DbSiNWDL1O0IxKDaTdir4dIx3+UOJCdkdJbIYH17k52u9of/52KYxssVeFMj62QjYgGiFwdTSjX7hClL3LfcF63HcJNoEu0hvtavF3qMyeduoQixrRX/Ks=" 15 | - LATEST_GOOD_CONDA_BUILD="1.16.0" 16 | - BUILDER_PYTHON_VERSION="2" 17 | - CONDA_PY=27 18 | # The python build restriction MUST be set at the moment, though it 19 | # can have any value. The setting below avoids known-bad builds on 20 | # python 2.6 and 3.3 for some packages. 21 | - PYTHON_BUILD_RESTRICTIONS="2.7*|>=3.4" 22 | 23 | # Matrix is fully specifiec (for now) by os versions 24 | # matrix: 25 | # fast_finish: true 26 | 27 | # include: 28 | # - os: linux 29 | # env: CONDA_PY=27 CONDA_BUILD_VERSION="" # selects latest version of conda-build 30 | 31 | # allow_failures: 32 | # # Canary in the coal mine to check out new versions of conda-build 33 | # - env: CONDA_PY=27 CONDA_BUILD_VERSION="" # selects latest version of conda-build 34 | 35 | install: 36 | - python ./Obvious-CI/bootstrap-obvious-ci-and-miniconda.py ${CONDA_INSTALL_LOCN} ${TARGET_ARCH} $BUILDER_PYTHON_VERSION --without-obvci 37 | - export PATH=${CONDA_INSTALL_LOCN}/bin:$PATH 38 | - conda config --set always_yes true 39 | - conda update --quiet conda 40 | # Install a couple of dependencies we need for sure. 41 | - conda install --quiet --yes astropy anaconda-client jinja2 cython pycrypto 42 | # Remove the patchelf install below if we go back to continuum-provided conda-build 43 | - if [ $TRAVIS_OS_NAME == "linux" ]; then conda install patchelf; fi 44 | - conda config --add channels astropy 45 | # Install custom version of conda-build for now (need to be able to pass 46 | # options to setup.py) 47 | - cd conda-build; python setup.py install; cd .. 48 | # Install obvious-ci; run 2to3 first if the build is python 3. 49 | - cd Obvious-CI; if [[ $BUILDER_PYTHON_VERSION == 3 ]]; then 2to3 -w .; fi; python setup.py install; cd .. 50 | 51 | script: 52 | # Get ready to build. 53 | - python affiliate-builder/prepare_packages.py requirements.yml 54 | - echo $PYTHON_RESTRICTIONS 55 | - if [[ -d recipes ]]; then obvci_conda_build_dir --build-condition="python $PYTHON_BUILD_RESTRICTIONS" recipes astropy; fi 56 | # Right now fails happen immediately on trying to build. 57 | # Raise an exception if any of the packages are not built. 58 | # - python affiliate-builder/check_build_results.py 59 | 60 | # Packages are now uploaded as they are built. 61 | # after_success: 62 | # # Upload to binstar...this should probably be done as the bdists are built. 63 | # - python affiliate-builder/upload_bdists.py 64 | -------------------------------------------------------------------------------- /requirements.yml: -------------------------------------------------------------------------------- 1 | - name: hgtools 2 | version: '6.3' 3 | 4 | # keyring has a recipe template 5 | - name: keyring 6 | version: '5.3' 7 | 8 | - name: iminuit 9 | version: 1.2 10 | 11 | - name: emcee 12 | version: 2.1.0 13 | 14 | # astropy-helpers has a recipe template 15 | - name: astropy-helpers 16 | version: 1.0.3 17 | 18 | - name: astroquery 19 | # Version should match the version on PyPI. Versions that could be 20 | # interpereted as numbers (e.g. 0.1) should be enclosed in quotes. 21 | version: 0.2.6 22 | 23 | # conda builds disable downloading, but astropy-helpers is typically 24 | # configured to try to autoupdate during install of affiliated 25 | # packages. Set to true if the package uses astropy-helpers and 26 | # auto-update and the --offline flag will be passed to setup.py. 27 | astropy_helpers: true # Defaults to false if omitted. 28 | 29 | # If the package contains compiled extensions that link to numpy this 30 | # must be set to true to ensure the package is built properly. 31 | # If in doubt, set it to true...though it should *always* be false 32 | # for a pure python package. 33 | numpy_compiled_extensions: false # Defaults to false if omitted. 34 | 35 | # Some packages can only be built for specific versions of python but 36 | # setup.py often does not contain those restrictions (and conda skeleton 37 | # ignores it if present), so list restrictions on python version here. 38 | 39 | # python: '>2.6|>=3.4' # if omitted, no restriction on python builds. 40 | 41 | # sncosmo has a recipe template 42 | - name: sncosmo 43 | version: 1.2.0 44 | astropy_helpers: true 45 | numpy_compiled_extensions: false 46 | 47 | - name: pydl 48 | version: 0.3.0 49 | astropy_helpers: true 50 | numpy_compiled_extensions: false 51 | 52 | # montage-wrapper has a recipe template 53 | - name: montage-wrapper 54 | version: 0.9.8 55 | astropy_helpers: true 56 | numpy_compiled_extensions: false 57 | 58 | - name: ccdproc 59 | version: 0.3.3 60 | astropy_helpers: true 61 | numpy_compiled_extensions: false 62 | 63 | - name: wcsaxes 64 | version: '0.6' 65 | astropy_helpers: true 66 | numpy_compiled_extensions: false 67 | 68 | - name: gammapy 69 | version: '0.3' 70 | astropy_helpers: true 71 | numpy_compiled_extensions: false 72 | 73 | # Fails because its astropy helpers is ancient/tries to import astropy??? 74 | # - name: pyvo 75 | # version: 0.0beta2 76 | # astropy_helpers: true 77 | # numpy_compiled_extensions: false 78 | 79 | - name: photutils 80 | version: '0.1' 81 | astropy_helpers: true 82 | numpy_compiled_extensions: false 83 | 84 | # Still has no source on pypi.... 85 | # - name: spherical-geometry 86 | # version: 1.0.4 87 | # astropy_helpers: true 88 | # numpy_compiled_extensions: false 89 | 90 | # APLpy currently has a recipe template 91 | - name: APLpy 92 | version: '1.0' 93 | astropy_helpers: true 94 | 95 | - name: specutils 96 | version: '0.1' 97 | astropy_helpers: true 98 | numpy_compiled_extensions: false 99 | 100 | # imexam has a recipe template 101 | - name: imexam 102 | version: 0.5.2 103 | astropy_helpers: true 104 | numpy_compiled_extensions: false 105 | python: '>2.6,<3' 106 | 107 | # Chokes on no source 108 | # - name: gwcs 109 | # version: 0.1.dev44 110 | # astropy_helpers: true 111 | # numpy_compiled_extensions: true 112 | 113 | # pyregion has a recipe template 114 | - name: pyregion 115 | version: 1.1.4 116 | astropy_helpers: true 117 | numpy_compiled_extensions: true 118 | 119 | # astroML has a recipe template 120 | - name: astroML 121 | version: '0.3' 122 | python: '>=2.6|>=3.3' 123 | 124 | # ginga has a recipe template 125 | - name: ginga 126 | version: 2.5.20151112204702 127 | astropy_helpers: true 128 | numpy_compiled_extensions: false 129 | python: '>2.6' 130 | 131 | # naima has a recipe template 132 | - name: naima 133 | version: '0.6.1' 134 | astropy_helpers: true 135 | numpy_compiled_extensions: false 136 | 137 | - name: pyephem 138 | version: 3.7.6.0 139 | 140 | # reproject has a recipe template 141 | - name: reproject 142 | version: '0.2' 143 | astropy_helpers: true 144 | numpy_compiled_extensions: true 145 | 146 | - name: astroplan 147 | version: '0.1' 148 | astropy_helpers: true 149 | numpy_compiled_extensions: false 150 | 151 | # python-cpl has a recipe template for now 152 | - name: python-cpl 153 | version: '0.7' 154 | astropy_helpers: false 155 | 156 | # astroscrappy has a recipe template 157 | - name: astroscrappy 158 | version: '1.0.3' 159 | astropy_helpers: true 160 | numpy_compiled_extensions: true 161 | -------------------------------------------------------------------------------- /affiliate-builder/prepare_packages.py: -------------------------------------------------------------------------------- 1 | from __future__ import (division, print_function, absolute_import) 2 | 3 | 4 | from argparse import ArgumentParser 5 | import os 6 | import re 7 | import hashlib 8 | import subprocess 9 | from collections import OrderedDict 10 | 11 | import yaml 12 | 13 | from binstar_client.utils import get_binstar 14 | from binstar_client.errors import NotFound 15 | from conda import config 16 | 17 | from astropy.extern import six 18 | from astropy.extern.six.moves import xmlrpc_client as xmlrpclib 19 | 20 | from jinja2 import Environment, FileSystemLoader 21 | from jinja2.exceptions import TemplateNotFound 22 | 23 | from generate_initial_versions import get_pypi_info 24 | 25 | BINSTAR_CHANNEL = 'astropy' 26 | PYPI_XMLRPC = 'https://pypi.python.org/pypi' 27 | BDIST_CONDA_FOLDER = 'bdist_conda' 28 | TEMPLATE_FOLDER = 'recipe_templates' 29 | RECIPE_FOLDER = 'recipes' 30 | BUILD_ORDER = 'build_order.txt' 31 | ALL_PLATFORMS = ['osx-64', 'linux-64', 'linux-32', 'win-32', 'win-64'] 32 | 33 | 34 | def setup_yaml(): 35 | """ 36 | Enable yaml to serialize an OrderedDict as a mapping. 37 | 38 | Cut and paste directly from: http://stackoverflow.com/a/31605131 39 | 40 | It in turn was condensed version of: http://stackoverflow.com/a/8661021 41 | """ 42 | represent_dict_order = lambda self, data: \ 43 | self.represent_mapping('tag:yaml.org,2002:map', data.items()) 44 | yaml.add_representer(OrderedDict, represent_dict_order) 45 | 46 | 47 | class Package(object): 48 | """ 49 | A package to be built for conda. 50 | 51 | Parameters 52 | ---------- 53 | 54 | pypi_name : str 55 | Name of the package on PyPI. Note that PyPI is not case sensitive. 56 | 57 | version: str, optional 58 | Version number of the package. ``None``, the default, implies the most 59 | recent version visible on PyPI should be used. 60 | """ 61 | 62 | # The class should only need one client for communicating with PyPI 63 | client = xmlrpclib.ServerProxy(PYPI_XMLRPC) 64 | 65 | def __init__(self, pypi_name, version=None, 66 | numpy_compiled_extensions=False, 67 | astropy_helpers=False, 68 | python_requirements=None): 69 | self._pypi_name = pypi_name 70 | self.required_version = version 71 | self._build = False 72 | self._url = None 73 | self._md5 = None 74 | self._build_platforms = None 75 | self._extra_meta = None 76 | self._build_pythons = None 77 | self._numpy_compiled_extensions = numpy_compiled_extensions 78 | self._astropy_helpers = astropy_helpers 79 | self._python_requirements = python_requirements 80 | 81 | @property 82 | def pypi_name(self): 83 | """ 84 | Name of the package on PyPI. 85 | """ 86 | return self._pypi_name 87 | 88 | @property 89 | def conda_name(self): 90 | """ 91 | Name of the package on binstar (conda), which requires lowercase 92 | names. 93 | """ 94 | return self.pypi_name.lower() 95 | 96 | @property 97 | def required_version(self): 98 | """ 99 | Version number of the package. 100 | """ 101 | return self._required_version 102 | 103 | @required_version.setter 104 | def required_version(self, value): 105 | self._required_version = str(value).strip() 106 | 107 | @property 108 | def build(self): 109 | """ 110 | bool: 111 | ``True`` if this package needs to be built. 112 | """ 113 | return self._build 114 | 115 | @build.setter 116 | def build(self, value): 117 | # TODO: Make sure this is a bool 118 | self._build = value 119 | 120 | @property 121 | def numpy_compiled_extensions(self): 122 | return self._numpy_compiled_extensions 123 | 124 | @property 125 | def astropy_helpers(self): 126 | return self._astropy_helpers 127 | 128 | @property 129 | def python_requirements(self): 130 | return self._python_requirements 131 | 132 | @property 133 | def is_dev(self): 134 | return not (re.search('[a-zA-Z]', self.required_version) is None) 135 | 136 | @property 137 | def url(self): 138 | if not self._url: 139 | self._retrieve_package_metadata() 140 | 141 | return self._url 142 | 143 | @property 144 | def md5(self): 145 | if not self._md5: 146 | self._retrieve_package_metadata() 147 | 148 | return self._md5 149 | 150 | @property 151 | def filename(self): 152 | return self.url.split('/')[-1] 153 | 154 | @property 155 | def build_platforms(self): 156 | """ 157 | Return list of platforms on which this package can be built. 158 | 159 | Defaults to the value of ``ALL_PLATFORMS``. 160 | 161 | Checks for build information by looking at recipe *templates*, which 162 | is probably not really the way to go...might be more generalizable if 163 | it looked at recipes instead. 164 | """ 165 | # Lazy memoization... 166 | if self._build_platforms: 167 | return self._build_platforms 168 | 169 | platform_info = self.extra_meta 170 | 171 | try: 172 | platforms = platform_info['extra']['platforms'] 173 | except KeyError: 174 | platforms = ALL_PLATFORMS 175 | 176 | self._build_platforms = platforms 177 | return self._build_platforms 178 | 179 | @property 180 | def build_pythons(self): 181 | if self._build_pythons: 182 | return self._build_pythons 183 | try: 184 | pythons = self.extra_meta['extra']['pythons'] 185 | except KeyError: 186 | pythons = ["27", "34"] 187 | 188 | # Make sure version is always a string so it can be compared 189 | # to CONDA_PY later. 190 | self._build_pythons = [str(p) for p in pythons] 191 | return self._build_pythons 192 | 193 | @property 194 | def extra_meta(self): 195 | """ 196 | The 'extra' metadata, for now read in from meta.yaml. 197 | """ 198 | if self._extra_meta is not None: 199 | return self._extra_meta 200 | 201 | template_dir = os.path.join(TEMPLATE_FOLDER, self.conda_name) 202 | 203 | try: 204 | meta = render_template(self, 'meta.yaml') 205 | except TemplateNotFound as e: 206 | # No recipe, make an empty meta for now. 207 | meta = '' 208 | 209 | platform_info = yaml.safe_load(meta) if meta else {} 210 | self._extra_meta = platform_info 211 | 212 | return self._extra_meta 213 | 214 | def _retrieve_package_metadata(self): 215 | """ 216 | Get URL and md5 checksum from PyPI for either the specified version 217 | or the most recent version. 218 | """ 219 | if not self.required_version: 220 | version = get_pypi_info(self.pypi_name) 221 | else: 222 | version = self.required_version 223 | 224 | urls = self.client.release_urls(self.pypi_name, version) 225 | try: 226 | # Many packages now have wheels, need to iterate over download 227 | # URLs to get the source distribution. 228 | for a_url in urls: 229 | if a_url['packagetype'] == 'sdist': 230 | url = a_url['url'] 231 | md5sum = a_url['md5_digest'] 232 | break 233 | else: 234 | # No source distribution, so raise an index error 235 | raise IndexError 236 | except IndexError: 237 | # Apparently a pypi release isn't required to have any source? 238 | # If it doesn't, then return None 239 | print('No source found for {}: {}'.format(self.pypi_name, 240 | self.required_version)) 241 | url = None 242 | md5sum = None 243 | self._url = url 244 | self._md5 = md5sum 245 | 246 | def download(self, directory, checksum=True): 247 | """ 248 | Download package and store in directory. 249 | 250 | Parameters 251 | ---------- 252 | directory : str 253 | Directory in which to store the downloaded package. 254 | 255 | checksum: bool, optional 256 | If ``True``, check the MD5 checksum of the download. 257 | """ 258 | loader = six.moves.urllib.request.URLopener() 259 | destination = os.path.join(directory, self.filename) 260 | print(destination) 261 | loader.retrieve(self.url, destination) 262 | if checksum: 263 | with open(destination, 'rb') as f: 264 | # Not worried about the packages being too big for memory. 265 | contents = f.read() 266 | md5_downloaded = hashlib.md5(contents).hexdigest() 267 | if md5_downloaded != self.md5: 268 | raise ValueError('checksum mismatch ' 269 | 'in {}'.format(self.filename)) 270 | 271 | @property 272 | def supported_platform(self): 273 | """ 274 | True if the current build platform is supported by the package, False 275 | otherwise. 276 | """ 277 | return config.subdir in self.build_platforms 278 | 279 | 280 | def get_package_versions(requirements_path): 281 | """ 282 | Read and parse list of packages. 283 | 284 | Parameters 285 | ---------- 286 | 287 | requirements_path : str 288 | Path to ``requirements.txt`` 289 | 290 | Returns 291 | ------- 292 | 293 | list 294 | List of ``Package`` objects, one for each in the requirements file. 295 | """ 296 | with open(requirements_path, 'rt') as f: 297 | package_list = yaml.safe_load(f) 298 | 299 | packages = [] 300 | for p in package_list: 301 | helpers = p.get('astropy_helpers', False) 302 | numpy_extensions = p.get('numpy_compiled_extensions', False) 303 | python_requirements = p.get('python', []) 304 | packages.append(Package(p['name'], 305 | version=p['version'], 306 | astropy_helpers=helpers, 307 | numpy_compiled_extensions=numpy_extensions, 308 | python_requirements=python_requirements)) 309 | 310 | return packages 311 | 312 | 313 | def _conda_python_build_string(): 314 | """ 315 | Construct the part of the conda build string that contains the python 316 | version. 317 | """ 318 | try: 319 | conda_python_version = os.environ['CONDA_PY'] 320 | except KeyError: 321 | raise RuntimeError('The environment variable CONDA_PY needs to be ' 322 | 'set before running this script.') 323 | # Remove the period if it is in the python version. 324 | conda_python_version = ''.join(conda_python_version.split('.')) 325 | return 'py' + conda_python_version 326 | 327 | 328 | def construct_build_list(packages, conda_channel=None): 329 | channel = conda_channel or BINSTAR_CHANNEL 330 | conda_py = _conda_python_build_string() 331 | 332 | for package in packages: 333 | print('Checking status of {}...'.format(package.conda_name), end="") 334 | binstar = get_binstar() 335 | 336 | # Decide whether the package needs to be built by checking to see if 337 | # it exists on binstar. 338 | try: 339 | binstar_info = binstar.release(channel, 340 | package.conda_name, 341 | package.required_version) 342 | except NotFound: 343 | # No builds for this version on any platform, so need to build. 344 | package.build = True 345 | 346 | if not package.build: 347 | # We have binstar_info, need to check whether we have this 348 | # platform and python version. 349 | for d in binstar_info['distributions']: 350 | if (d['attrs']['subdir'] == config.subdir 351 | and conda_py in d['attrs']['build']): 352 | 353 | break 354 | else: 355 | package.build = True 356 | 357 | unsupported_platform = config.subdir not in package.build_platforms 358 | unsupported_python = conda_py[2:] not in package.build_pythons 359 | 360 | if not package.build: 361 | build_message = "do not build" 362 | elif package.is_dev: 363 | build_message = 'skip because package version is dev' 364 | elif unsupported_platform: 365 | build_message = 'build not supported on this platform' 366 | elif unsupported_python: 367 | build_message = 'build not supported on this python version' 368 | elif not package.url: 369 | build_message = 'no source found on PyPI' 370 | else: 371 | build_message = 'BUILD' 372 | 373 | package.build = (package.build and not package.is_dev 374 | and package.url and not unsupported_platform 375 | and not unsupported_python) 376 | 377 | print(build_message) 378 | 379 | return [p for p in packages if p.build] 380 | 381 | 382 | def write_build_order(build_bdist): 383 | """ 384 | Write list of directories to be built in the order they appear in 385 | requirements file. 386 | """ 387 | names = [p.conda_name for p in build_bdist] 388 | with open(BUILD_ORDER, 'wt') as f: 389 | f.writelines('\n'.join(names)) 390 | 391 | 392 | def render_template(package, template): 393 | """ 394 | Render recipe components from jinja2 templates. 395 | 396 | Parameters 397 | ---------- 398 | 399 | package : Package 400 | :class:`Package` object for which template will be rendered. 401 | template : str 402 | Name of template file, path relative to ``TEMPLATE_FOLDER``. 403 | """ 404 | full_template_path = os.path.abspath(TEMPLATE_FOLDER) 405 | jinja_env = Environment(loader=FileSystemLoader(full_template_path)) 406 | tpl = jinja_env.get_template('/'.join([package.conda_name, template])) 407 | rendered = tpl.render(version=package.required_version, md5=package.md5) 408 | return rendered 409 | 410 | 411 | def generate_skeleton(package, path): 412 | """ 413 | Use conda skeleton pypi to generate a recipe for a package and 414 | save it to path. 415 | 416 | Parameters 417 | ---------- 418 | 419 | package: Package 420 | The package for which a recipe is to be generated. 421 | 422 | path: str 423 | Path to which the recipe should be written. 424 | """ 425 | 426 | additional_arguments = ['--version', str(package.required_version), 427 | '--output-dir', path] 428 | 429 | if package.astropy_helpers: 430 | additional_arguments.extend(['--setup-options=--offline']) 431 | 432 | if package.numpy_compiled_extensions: 433 | additional_arguments.append('--pin-numpy') 434 | 435 | subprocess.check_call(["conda", "skeleton", "pypi", package.pypi_name] + 436 | additional_arguments) 437 | 438 | 439 | def inject_python_requirements(package, recipe_path): 440 | meta_path = os.path.join(recipe_path, 'meta.yaml') 441 | with open(meta_path) as f: 442 | recipe = yaml.safe_load(f) 443 | python_spec = ' '.join(['python', package.python_requirements]) 444 | for section in ['build', 'run']: 445 | recipe['requirements'][section].append(python_spec) 446 | 447 | with open(meta_path, 'w') as f: 448 | yaml.dump(recipe, f, default_flow_style=False) 449 | 450 | 451 | def main(args): 452 | packages = get_package_versions(args.requirements) 453 | 454 | packages = [p for p in packages if p.supported_platform] 455 | 456 | needs_recipe = os.listdir(TEMPLATE_FOLDER) 457 | 458 | build_recipe = [p for p in packages if p.conda_name in needs_recipe] 459 | build_skeleton = [p for p in packages if p.conda_name not in needs_recipe] 460 | 461 | if build_recipe or build_skeleton: 462 | os.mkdir(RECIPE_FOLDER) 463 | 464 | # Write recipes from templates. 465 | for p in build_recipe: 466 | print('Writing recipe for {}.'.format(p.conda_name)) 467 | recipe_path = os.path.join(RECIPE_FOLDER, p.conda_name) 468 | template_path = os.path.join(TEMPLATE_FOLDER, p.conda_name) 469 | os.mkdir(recipe_path) 470 | templates = [d for d in os.listdir(template_path) if not d.startswith('.')] 471 | for template in templates: 472 | rendered = render_template(p, template) 473 | with open(os.path.join(recipe_path, template), 'wt') as f: 474 | f.write(rendered) 475 | 476 | # Use conda skeleton to generate recipes for the simple cases 477 | for p in build_skeleton: 478 | recipe_destination = os.path.join(RECIPE_FOLDER, p.conda_name) 479 | generate_skeleton(p, RECIPE_FOLDER) 480 | if p.python_requirements: 481 | inject_python_requirements(p, recipe_destination) 482 | 483 | 484 | if __name__ == '__main__': 485 | parser = ArgumentParser('command line tool for building packages.') 486 | parser.add_argument('requirements', 487 | help='Full path to requirements.txt') 488 | args = parser.parse_args() 489 | main(args) 490 | --------------------------------------------------------------------------------