{% set version = "6.1.1" %}

package:
  name: robotframework-split
  version: {{ version }}

source:
  - url: https://pypi.io/packages/source/r/robotframework/robotframework-{{ version }}.zip
    sha256: 3fa18f2596a4df2418c4b59abf43248327c15ed38ad8665f6a9a9c75c95d7789
    folder: dist
  - url: https://github.com/robotframework/robotframework/archive/v{{ version }}.tar.gz
    sha256: 1045dc4482f16737f58686b659f2cd8a91750ecb1707389051ada075f79e9e32
    folder: src
    patches:
      - patches/0001_skip-tests-wrong-timezone-set.patch
      - patches/0002_skip-test_clear_namespace_between_runs-for-win.patch  # [win]

build:
  number: 0

requirements:
  host:
    - pip
    - python
    - wheel
    - setuptools
  build:
    - patch     # [not win]
    - m2-patch  # [win]
  run:
    - python

outputs:
  - name: robotframework
    build:
      script:
        - cd dist
        - {{ PYTHON }} -m pip install . --no-deps --no-build-isolation -vv
      entry_points:
        - robot = robot.run:run_cli
        - rebot = robot.rebot:rebot_cli
        - libdoc = robot.libdoc:libdoc_cli
    requirements:
      host:
        - pip
        - python
        - wheel
        - setuptools
      run:
        - python
    test:
      requires:
        - pip
      imports:
        - robot
        - robot.api
        - robot.conf
        - robot.htmldata
        - robot.libdocpkg
        - robot.libraries
        - robot.model
        - robot.output
        - robot.output.console
        - robot.parsing
        - robot.reporting
        - robot.result
        - robot.running
        - robot.running.arguments
        - robot.running.timeouts
        - robot.utils
        - robot.variables
      commands:
        - pip check
        # the `--version` commands return rc 251
        # - robot --version
        # - rebot --version
        # - libdoc --version
        # generate simple test file (`echo` and `>>` are cross-platform)
        - echo "*** Test Cases ***"                   >> test-{{ version }}.robot  # [unix]
        - echo "Hello World"                          >> test-{{ version }}.robot  # [unix]
        - echo "    Log   %{PKG_NAME} %{PKG_VERSION}" >> test-{{ version }}.robot  # [unix]
        # on win the quotes are rendered in the files, and they would be incorrect test files
        - echo *** Test Cases *** >> test-{{ version }}.robot  # [win]
        - echo|(set /p="Hello World    Log   %%{PKG_NAME} %%{PKG_VERSION}" & echo.) >> test-{{ version }}.robot  # [win]
        # smoke test
        - robot test-{{ version }}.robot
        - rebot output.xml
        - libdoc test-{{ version }}.robot test.html

  - name: _robotframework_tests
    requirements:
      host:
        - pip
        - python
        - wheel
        - setuptools
      run:
        - python
        - {{ pin_subpackage('robotframework', exact=True) }}
    test:
      requires:
        - docutils
        - jsonschema
        - lxml
        - pillow
        - pip
        - pygments
        - pyyaml
      source_files:
        - src/utest
        - src/atest
        # win does not copy this one only subfolder
        - src/atest/testresources  # [win] 
        - src/doc/schema
        - src/README.rst
      commands:
        - pip check
        - cd src
        - cd utest 
        - python run.py
      about:
        license: Apache-2.0
        license_family: Apache
        license_file:
          - dist/LICENSE.txt
          - dist/COPYRIGHT.txt
        summary: >
          A package for the tests assets of `robotframework`: should not normally be needed.

about:
  home: https://robotframework.org
  license: Apache-2.0
  license_family: Apache
  license_file:
    - dist/LICENSE.txt
    - dist/COPYRIGHT.txt
  summary: Generic automation framework for acceptance testing and robotic process automation (RPA)
  doc_url: https://robotframework.org/robotframework/{{ version }}/RobotFrameworkUserGuide.html
  dev_url: https://github.com/robotframework/robotframework
  description: >
    Robot Framework is a generic open source automation framework for acceptance testing, acceptance test driven development (ATDD), and robotic process automation (RPA). It has simple plain text syntax and it can be extended easily with libraries implemented using Python or Java.

extra:
  feedstock-name: robotframework
  recipe-maintainers:
    - abloemert
    - bollwyvl
