From 7b97dae97fa0527e5db68d8e49aee934df6067bd Mon Sep 17 00:00:00 2001 From: heck Date: Mon, 11 Jan 2021 23:52:52 +0100 Subject: [PATCH] add pEpACIDgen-config using entry_points --- gen/{bin/pEp_acid_gen => pEpACIDgen/__main__.py} | 12 +++++++++--- gen/setup.cfg | 14 ++++++++------ gen/setup.py | 4 +--- 3 files changed, 18 insertions(+), 12 deletions(-) rename gen/{bin/pEp_acid_gen => pEpACIDgen/__main__.py} (80%) mode change 100755 => 100644 diff --git a/gen/bin/pEp_acid_gen b/gen/pEpACIDgen/__main__.py old mode 100755 new mode 100644 similarity index 80% rename from gen/bin/pEp_acid_gen rename to gen/pEpACIDgen/__main__.py index 8a635b3..8e0db08 --- a/gen/bin/pEp_acid_gen +++ b/gen/pEpACIDgen/__main__.py @@ -3,6 +3,7 @@ # This file is under GNU Affero General Public License 3.0 # see LICENSE.txt +import os import sys import json import pEpACIDgen @@ -16,7 +17,8 @@ def usage(): def print_indent(*args, indent=0): print('\t' * indent, *args) -def main(): +# entry_point (command/script): pEp_acid_gen +def gen(): if len(sys.argv) <= 1: usage() exit(-1) @@ -65,5 +67,9 @@ def main(): utils.write_string(header["acid_yml"], "./" + "py_module" + ".yml2", ) -if __name__ == "__main__": - main() +# entry_point (command/script): pEp_acid_gen-config +def get_gen_backend_pyBind11(): + dir_self = os.path.abspath(os.path.dirname(__file__)) + gen_backend_dir = os.path.join(dir_self, "gen_backend") + pybind_backend_file = os.path.join(gen_backend_dir,"gen_pybind11.ysl2") + print(pybind_backend_file) diff --git a/gen/setup.cfg b/gen/setup.cfg index 5d0b35e..d346bb1 100644 --- a/gen/setup.cfg +++ b/gen/setup.cfg @@ -22,24 +22,26 @@ classifiers = [options] -scripts = bin/pEp_acid_gen - +include_package_data=true packages = find: python_requires = >= 3.6 - zip_safe = true -# include_package_data = true -# keep aligned with setup.py -#test_suite = tests +test_suite = tests # deprecated/redundant with pyproject.toml, but lets keep both ways around for now setup_requires = setuptools >= 39.2.0 wheel >= 0.35.1 + pybind11 >= 2.6.1 install_requires = clang yml2 +[options.entry_points] +console_scripts = + pEp_acid_gen = pEpACIDgen.__main__:gen + pEp_acid_gen-config = pEpACIDgen.__main__:get_gen_backend_pyBind11 + [options.extras_require] test = pytest diff --git a/gen/setup.py b/gen/setup.py index b5e65ef..8d3bfa6 100644 --- a/gen/setup.py +++ b/gen/setup.py @@ -3,6 +3,4 @@ # see LICENSE.txt from setuptools import setup - -setup( -) +setup()