From b04d5a8a4326e0d98529938f072f1a998d628790 Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand Date: Fri, 8 Sep 2023 10:01:51 +0200 Subject: [PATCH 1/2] Fix python 3.11 support Add patch from open PR https://github.com/pjkundert/cpppo/pull/110 --- recipe/meta.yaml | 4 +- recipe/python-311-support-pr110.patch | 65 +++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 recipe/python-311-support-pr110.patch diff --git a/recipe/meta.yaml b/recipe/meta.yaml index a092f8d..7e3ee2e 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -10,11 +10,13 @@ source: sha256: 8c5a2947d6e9fd732d2d887fa02216beebb4068ab99e2590590f491425992bc6 patches: - remove_getattr_entrypoint.diff + # From https://github.com/pjkundert/cpppo/pull/110 + - python-311-support-pr110.patch build: noarch: python script: {{ PYTHON }} -m pip install . -vv - number: 0 + number: 1 entry_points: - enip_server = cpppo.server.enip.main:main - enip_client = cpppo.server.enip.client:main diff --git a/recipe/python-311-support-pr110.patch b/recipe/python-311-support-pr110.patch new file mode 100644 index 0000000..8a98745 --- /dev/null +++ b/recipe/python-311-support-pr110.patch @@ -0,0 +1,65 @@ +diff --git a/misc.py b/misc.py +index 99a41ad..f063b97 100644 +--- a/misc.py ++++ b/misc.py +@@ -136,41 +136,29 @@ def change_function( function, **kwds ): + + will change the func's co_filename to the specified string. + +- The types.CodeType constructor differs between Python 2 and 3; see +- type help(types.CodeType) at the interpreter prompt for information: ++ The types.CodeType constructor differs between Python versions; see ++ type help(types.CodeType) at the interpreter prompt for information. + +- Python2: +- code(argcount, nlocals, stacksize, flags, codestring, +- | constants, names, varnames, filename, name, firstlineno, +- | lnotab[, freevars[, cellvars]]) ++ """ + +- Python3: +- code(argcount, kwonlyargcount, nlocals, stacksize, flags, codestring, +- | constants, names, varnames, filename, name, firstlineno, +- | lnotab[, freevars[, cellvars]]) ++ version_lookup = { ++ (2, 7): ["co_argcount", "co_nlocals", "co_stacksize", "co_flags", "co_code", "co_consts", "co_names", "co_varnames", "co_filename", "co_name", "co_firstlineno", "co_lnotab", "co_freevars", "co_cellvars"], ++ (3, 7): ["co_argcount", "co_kwonlyargcount", "co_nlocals", "co_stacksize", "co_flags", "co_code", "co_consts", "co_names", "co_varnames", "co_filename", "co_name", "co_firstlineno", "co_lnotab", "co_freevars", "co_cellvars"], ++ (3, 8): ["co_argcount", "co_posonlyargcount", "co_kwonlyargcount", "co_nlocals", "co_stacksize", "co_flags", "co_code", "co_consts", "co_names", "co_varnames", "co_filename", "co_name", "co_firstlineno", "co_lnotab", "co_freevars", "co_cellvars"], ++ (3, 9): ["co_argcount", "co_posonlyargcount", "co_kwonlyargcount", "co_nlocals", "co_stacksize", "co_flags", "co_code", "co_consts", "co_names", "co_varnames", "co_filename", "co_name", "co_firstlineno", "co_lnotab", "co_freevars", "co_cellvars"], ++ (3, 10): ["co_argcount", "co_posonlyargcount", "co_kwonlyargcount", "co_nlocals", "co_stacksize", "co_flags", "co_code", "co_consts", "co_names", "co_varnames", "co_filename", "co_name", "co_firstlineno", "co_linetable", "co_freevars", "co_cellvars"], ++ (3, 11): ["co_argcount", "co_posonlyargcount", "co_kwonlyargcount", "co_nlocals", "co_stacksize", "co_flags", "co_code", "co_consts", "co_names", "co_varnames", "co_filename", "co_name", "co_qualname", "co_firstlineno", "co_linetable", "co_exceptiontable", "co_freevars", "co_cellvars"] ++ } + ++ version, minor = sys.version_info[0], sys.version_info[1] + +- """ +- # Enumerate all the __code__ attributes in the same order; types.CodeTypes +- # doesn't accept keyword args, only position. +- attrs = [ "co_argcount" ] +- if sys.version_info[0] >= 3: +- attrs += [ "co_kwonlyargcount" ] +- if sys.version_info[1] >= 8: +- attrs += [ "co_posonlyargcount" ] +- attrs += [ "co_nlocals", +- "co_stacksize", +- "co_flags", +- "co_code", +- "co_consts", +- "co_names", +- "co_varnames", +- "co_filename", +- "co_name", +- "co_firstlineno", +- "co_lnotab", +- "co_freevars", +- "co_cellvars" ] ++ # Clamp major version to 2 or 3 ++ version = max(min(version, 3), 2) ++ ++ # Clamp minor version to 7-11 ++ minor = max(min(minor, 11), 7) ++ ++ attrs = version_lookup[(version, minor)] + + assert all( k in attrs for k in kwds ), \ + "Invalid function keyword(s) supplied: %s" % ( ", ".join( kwds.keys() )) From 8e3e49fce6a18b0f419bc082f86c67d056bfcb01 Mon Sep 17 00:00:00 2001 From: "conda-forge-webservices[bot]" <91080706+conda-forge-webservices[bot]@users.noreply.github.com> Date: Fri, 8 Sep 2023 08:05:15 +0000 Subject: [PATCH 2/2] MNT: Re-rendered with conda-build 3.26.1, conda-smithy 3.25.1, and conda-forge-pinning 2023.09.07.15.45.04 --- .azure-pipelines/azure-pipelines-linux.yml | 5 ---- .circleci/config.yml | 2 +- .scripts/build_steps.sh | 9 ++++++- LICENSE.txt | 30 ++++++++++++++++------ README.md | 8 +++--- build-locally.py | 19 +++++++++----- 6 files changed, 48 insertions(+), 25 deletions(-) diff --git a/.azure-pipelines/azure-pipelines-linux.yml b/.azure-pipelines/azure-pipelines-linux.yml index 974e878..a20f315 100755 --- a/.azure-pipelines/azure-pipelines-linux.yml +++ b/.azure-pipelines/azure-pipelines-linux.yml @@ -15,11 +15,6 @@ jobs: timeoutInMinutes: 360 steps: - - script: | - rm -rf /opt/ghc - df -h - displayName: Manage disk space - # configure qemu binfmt-misc running. This allows us to run docker containers # embedded qemu-static - script: | diff --git a/.circleci/config.yml b/.circleci/config.yml index 3e61aa2..8b4ef2f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ # This file was generated automatically from conda-smithy. To update this configuration, # update the conda-forge.yml and/or the recipe/meta.yaml. -# -*- mode: yaml -*- +# -*- mode: jinja-yaml -*- version: 2 diff --git a/.scripts/build_steps.sh b/.scripts/build_steps.sh index d71d6ae..595f8b5 100755 --- a/.scripts/build_steps.sh +++ b/.scripts/build_steps.sh @@ -24,7 +24,10 @@ export CONFIG_FILE="${CI_SUPPORT}/${CONFIG}.yaml" cat >~/.condarc < /dev/null +if [[ -f "${FEEDSTOCK_ROOT}/LICENSE.txt" ]]; then + cp "${FEEDSTOCK_ROOT}/LICENSE.txt" "${RECIPE_ROOT}/recipe-scripts-license.txt" +fi + if [[ "${BUILD_WITH_CONDA_DEBUG:-0}" == 1 ]]; then if [[ "x${BUILD_OUTPUT_ID:-}" != "x" ]]; then EXTRA_CB_OPTIONS="${EXTRA_CB_OPTIONS:-} --output-id ${BUILD_OUTPUT_ID}" diff --git a/LICENSE.txt b/LICENSE.txt index 6ec1401..2ec51d7 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,13 +1,27 @@ -BSD 3-clause license +BSD-3-Clause license Copyright (c) 2015-2022, conda-forge contributors All rights reserved. -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. diff --git a/README.md b/README.md index da33515..3f9b4fd 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -About cpppo -=========== +About cpppo-feedstock +===================== + +Feedstock license: [BSD-3-Clause](https://github.com/conda-forge/cpppo-feedstock/blob/main/LICENSE.txt) Home: https://github.com/pjkundert/cpppo Package license: GPL-3.0-or-later -Feedstock license: [BSD-3-Clause](https://github.com/conda-forge/cpppo-feedstock/blob/main/LICENSE.txt) - Summary: Cpppo is a Communication Protocol Python Parser and Originator Current build status diff --git a/build-locally.py b/build-locally.py index eec38a0..3f4b7a7 100755 --- a/build-locally.py +++ b/build-locally.py @@ -86,12 +86,19 @@ def main(args=None): verify_config(ns) setup_environment(ns) - if ns.config.startswith("linux") or ( - ns.config.startswith("osx") and platform.system() == "Linux" - ): - run_docker_build(ns) - elif ns.config.startswith("osx"): - run_osx_build(ns) + try: + if ns.config.startswith("linux") or ( + ns.config.startswith("osx") and platform.system() == "Linux" + ): + run_docker_build(ns) + elif ns.config.startswith("osx"): + run_osx_build(ns) + finally: + recipe_license_file = os.path.join( + "recipe", "recipe-scripts-license.txt" + ) + if os.path.exists(recipe_license_file): + os.remove(recipe_license_file) if __name__ == "__main__":