conda / conda-build

Commands and tools for building conda packages
https://docs.conda.io/projects/conda-build/
Other
381 stars 420 forks source link

PyPI data in meta.yaml not properly escaped from Jinja by conda skeleton #2237

Closed wshanks closed 2 years ago

wshanks commented 7 years ago

The following commands

conda skeleton pypi colorlog --version 2.10.0
conda build colorlog --no-anaconda-upload --output-folder .

give this error:

Error: Invalid selector in meta.yaml line 74:
    [`fileConfig`]: http://docs.python.org/3/library/logging.config.html#logging.config.fileConfig\n[`logging.addLevelName`]: https://docs.python.org/3/library/logging.html#logging.addLevelName\n[`logging.Formatter`]:\

The error is complaining about a line in the middle of the description from PyPI. The description has a lot of syntax in it. It seems like Jinja is trying to parse it.

Here is the full content of meta.yaml:

{% set name = "colorlog" %}
{% set version = "2.10.0" %}
{% set hash_type = "sha256" %}
{% set hash_value = "229cd0794a19d8f33b2b4a4b70e1225b6c010af96c2dc8615279abbc1bb3929a" %}

package:
  name: '{{ name|lower }}'
  version: '{{ version }}'

source:
  fn: '{{ name }}-{{ version }}.tar.gz'
  url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
  '{{ hash_type }}': '{{ hash_value }}'

build:
  number: 0
  script: python setup.py install  --single-version-externally-managed --record=record.txt

requirements:
  build:
    - python
    - setuptools
  run:
    - python

test:
  imports:
    - colorlog
    - colorlog.tests

about:
  home: https://github.com/borntyping/python-colorlog
  license: MIT License
  license_family: MIT
  license_file: ''
  summary: Log formatting with colors!
  description: "\n# Log formatting with colors!\n\n[![](https://img.shields.io/pypi/v/colorlog.svg)](https://warehouse.python.org/project/colorlog/) [![](https://img.shields.io/pypi/l/colorlog.svg)](https://warehouse.python.org/project/colorlog/)\
    \ [![](https://img.shields.io/travis/borntyping/python-colorlog/master.svg)](https://travis-ci.org/borntyping/python-colorlog)\n\n`colorlog.ColoredFormatter` is a formatter for use with Python's `logging`\n\
    module that outputs records using terminal colors.\n\n* [Source on GitHub](https://github.com/borntyping/python-colorlog)\n* [Packages on PyPI](https://pypi.python.org/pypi/colorlog)\n* [Builds on Travis\
    \ CI](https://travis-ci.org/borntyping/python-colorlog)\n\nInstallation\n------------\n\nInstall from PyPI with:\n\n```bash\npip install colorlog\n```\n\nSeveral Linux distributions provide offical\
    \ packages ([Debian], [Gentoo],\n[OpenSuse] and [Ubuntu]), and others have user provided packages ([Arch AUR],\n[BSD ports], [Conda], [Fedora packaging scripts]).\n\nUsage\n-----\n\n```python\nimport\
    \ colorlog\n\nhandler = colorlog.StreamHandler()\nhandler.setFormatter(colorlog.ColoredFormatter(\n\t'%(log_color)s%(levelname)s:%(name)s:%(message)s'))\n\nlogger = colorlog.getLogger('example')\nlogger.addHandler(handler)\n\
    ```\n\nThe `ColoredFormatter` class takes several arguments:\n\n- `format`: The format string used to output the message (required).\n- `datefmt`: An optional date format passed to the base class. See\
    \ [`logging.Formatter`].\n- `reset`: Implicitly adds a color reset code to the message output, unless the output already ends with one. Defaults to `True`.\n- `log_colors`: A mapping of record level\
    \ names to color names. The defaults can be found in `colorlog.default_log_colors`, or the below example.\n- `secondary_log_colors`: A mapping of names to `log_colors` style mappings, defining additional\
    \ colors that can be used in format strings. See below for an example.\n- `style`: Available on Python 3.2 and above. See [`logging.Formatter`].\n\nColor escape codes can be selected based on the log\
    \ records level, by adding\nparameters to the format string:\n\n- `log_color`: Return the color associated with the records level.\n- `<name>_log_color`: Return another color based on the records level\
    \ if the formatter has secondary colors configured (see `secondary_log_colors` below).\n\nThe following escape codes are made available for use in the format string:\n\n- `{color}`, `fg_{color}`, `bg_{color}`:\
    \ Foreground and background colors.\n- `bold`, `bold_{color}`, `fg_bold_{color}`, `bg_bold_{color}`: Bold/bright colors.\n- `reset`: Clear all formatting (both foreground and background colors).\n\n\
    The availible color names are `black`, `red`, `green`, `yellow`, `blue`,\n`purple`, `cyan` and `white`. Multiple escape codes can be used at once by\njoining them with commas. This example would return\
    \ the escape codes for black\ntext on a white background:\n\n```python\ncolorlog.escape_codes.parse_colors(\"black,bg_white\")\n```\n\nExamples\n--------\n\n![Example output](doc/example.png)\n\nThe\
    \ following code creates a `ColoredFormatter` for use in a logging setup,\nusing the default values for each argument.\n\n```python\nfrom colorlog import ColoredFormatter\n\nformatter = ColoredFormatter(\n\
    \t\"%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s\",\n\tdatefmt=None,\n\treset=True,\n\tlog_colors={\n\t\t'DEBUG':    'cyan',\n\t\t'INFO':     'green',\n\t\t'WARNING':  'yellow',\n\t\t'ERROR':\
    \    'red',\n\t\t'CRITICAL': 'red,bg_white',\n\t},\n\tsecondary_log_colors={},\n\tstyle='%'\n)\n```\n\nUsing `secondary_log_colors`\n------------------------------\n\nSecondary log colors are a way\
    \ to have more than one color that is selected\nbased on the log level. Each key in `secondary_log_colors` adds an attribute\nthat can be used in format strings (`message` becomes `message_log_color`),\
    \ and\nhas a corresponding value that is identical in format to the `log_colors`\nargument.\n\nThe following example highlights the level name using the default log colors,\nand highlights the message\
    \ in red for `error` and `critical` level log messages.\n\n```python\nfrom colorlog import ColoredFormatter\n\nformatter = ColoredFormatter(\n\t\"%(log_color)s%(levelname)-8s%(reset)s %(message_log_color)s%(message)s\"\
    ,\n\tsecondary_log_colors={\n\t\t'message': {\n\t\t\t'ERROR':    'red',\n\t\t\t'CRITICAL': 'red'\n\t\t}\n\t}\n)\n```\n\nWith [`dictConfig`]\n-------------------\n\n```python\nlogging.config.dictConfig({\n\
    \t'formatters': {\n\t\t'colored': {\n\t\t\t'()': 'colorlog.ColoredFormatter',\n\t\t\t'format': \"%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s\"\n\t\t}\n\t},\n\n\t...\n})\n```\n\nA full\
    \ example dictionary can be found in `tests/test_colorlog.py`.\n\nWith [`fileConfig`]\n-------------------\n\n```ini\n...\n\n[formatters]\nkeys=color\n\n[formatter_color]\nclass=colorlog.ColoredFormatter\n\
    format=%(log_color)s%(levelname)-8s%(reset)s %(bg_blue)s[%(name)s]%(reset)s %(message)s from fileConfig\ndatefmt=%m-%d %H:%M:%S\n```\n\nAn instance of ColoredFormatter created with those arguments will\
    \ then be used\nby any handlers that are configured to use the `color` formatter.\n\nA full example configuration can be found in `tests/test_config.ini`.\n\nWith custom log levels\n----------------------\n\
    \nColoredFormatter will work with custom log levels added with\n[`logging.addLevelName`]:\n\n```python\nimport logging, colorlog\nTRACE = 5\nlogging.addLevelName(TRACE, 'TRACE')\nformatter = colorlog.ColoredFormatter(log_colors={'TRACE':\
    \ 'yellow'})\nhandler = logging.StreamHandler()\nhandler.setFormatter(formatter)\nlogger = logging.getLogger('example')\nlogger.addHandler(handler)\nlogger.setLevel('TRACE')\nlogger.log(TRACE, 'a message\
    \ using a custom level')\n```\n\nCompatibility\n=============\n\ncolorlog works on Python 2.6 and above, including Python 3.\n\nOn Windows, requires [colorama] to work properly. A dependancy on [colorama]\
    \ is\nincluded as an optional package dependancy - depending on `colorlog[windows]`\ninstead of `colorlog` will ensure it is included when installing.\n\nTests\n=====\n\nTests similar to the above examples\
    \ are found in `tests/test_colorlog.py`.\n\n[`tox`] will run the tests under all compatible python versions.\n\n\nProjects using colorlog\n-----------------------\n\n- [Counterparty]\n- [Errbot]\n-\
    \ [Pythran]\n- [zenlog]\n\nLicence\n-------\n\nCopyright (c) 2012 Sam Clements <sam@borntyping.co.uk>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software\
    \ and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense,\
    \ and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice\
    \ shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE\
    \ WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n\
    IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[`dictConfig`]: http://docs.python.org/3/library/logging.config.html#logging.config.dictConfig\n\
    [`fileConfig`]: http://docs.python.org/3/library/logging.config.html#logging.config.fileConfig\n[`logging.addLevelName`]: https://docs.python.org/3/library/logging.html#logging.addLevelName\n[`logging.Formatter`]:\
    \ http://docs.python.org/3/library/logging.html#logging.Formatter\n[`tox`]: http://tox.readthedocs.org/\n[Arch AUR]: https://aur.archlinux.org/packages/python-colorlog/\n[BSD ports]: https://www.freshports.org/devel/py-colorlog/\n\
    [colorama]: https://pypi.python.org/pypi/colorama\n[Conda]: https://anaconda.org/auto/colorlog\n[Counterparty]: https://counterparty.io/\n[Debian]: https://packages.debian.org/jessie/python-colorlog\n\
    [Errbot]: http://errbot.io/\n[Fedora packaging scripts]: https://github.com/bartv/python-colorlog\n[Gentoo]: https://packages.gentoo.org/packages/dev-python/colorlog\n[OpenSuse]: http://rpm.pbone.net/index.php3?stat=3&search=python-colorlog&srodzaj=3\n\
    [Pythran]: http://pythonhosted.org/pythran/DEVGUIDE.html\n[Ubuntu]: https://launchpad.net/python-colorlog\n[zenlog]: https://github.com/ManufacturaInd/python-zenlog\n"
  doc_url: ''
  dev_url: ''

extra:
  recipe-maintainers: ''
mandeep commented 7 years ago

Thanks for reporting this. It looks like we need to implement some kind of parsing for project descriptions that use their README as long_description in setup.py or fallback on short_description.

github-actions[bot] commented 2 years ago

Hi there, thank you for your contribution!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue at hand
  2. Comment that the issue is still reproducible and include:
    • What OS and version you reproduced the issue on
    • What steps you followed to reproduce the issue

NOTE: If this issue was closed prematurely, please leave a comment.

Thanks!