diff --git a/appveyor.yml b/appveyor.yml index 0a57f36..e789e1e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,4 @@ environment: - TWINE_USERNAME: penguinolog - TWINE_PASSWORD: - secure: TCKGf77kkVeo2Pbd+lQY5Q== - matrix: - PYTHON: "C:\\Python35" PYTHON_VERSION: "3.5.x" # currently 3.5.1 @@ -20,6 +16,14 @@ environment: PYTHON_VERSION: "3.6.x" # currently 3.6.0 PYTHON_ARCH: "64" + - PYTHON: "C:\\Python37" + PYTHON_VERSION: "3.7.x" # currently 3.6.0 + PYTHON_ARCH: "32" + + - PYTHON: "C:\\Python37-x64" + PYTHON_VERSION: "3.7.x" # currently 3.6.0 + PYTHON_ARCH: "64" + install: - cmd: echo "Using cmd" @@ -56,6 +60,3 @@ test_script: artifacts: - path: dist\* name: Python built code - -on_success: - - if "%APPVEYOR_REPO_TAG%"=="true" ( pip install -U twine && twine upload dist/*.whl ) diff --git a/logwrap/__init__.pxd b/logwrap/__init__.pxd index aa09ac5..a607901 100644 --- a/logwrap/__init__.pxd +++ b/logwrap/__init__.pxd @@ -1 +1,9 @@ cpdef tuple __all__ + +cpdef str __version__ +cpdef str __author__ +cpdef str __author_email__ +cpdef dict __maintainers__ +cpdef str __url__ +cpdef str __description__ +cpdef str __license__ diff --git a/logwrap/__init__.pyx b/logwrap/__init__.pyx index 765d677..fa0303d 100644 --- a/logwrap/__init__.pyx +++ b/logwrap/__init__.pyx @@ -1,3 +1,19 @@ +# Copyright 2016-2018 Alexey Stepanov aka penguinolog +## +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import pkg_resources + from .repr_utils cimport PrettyFormat, PrettyRepr, PrettyStr, pretty_repr, pretty_str from .log_wrap cimport LogWrap @@ -14,3 +30,27 @@ cpdef tuple __all__ = ( "BoundParameter", "bind_args_kwargs", ) + +cpdef str __version__ + +try: + __version__ = pkg_resources.get_distribution(__name__).version +except pkg_resources.DistributionNotFound: + # package is not installed, try to get from SCM + try: + import setuptools_scm # type: ignore + + __version__ = setuptools_scm.get_version() + except ImportError: + pass + +cpdef str __author__ = "Alexey Stepanov" +cpdef str __author_email__ = "penguinolog@gmail.com" +cpdef dict __maintainers__ = { + "Alexey Stepanov": "penguinolog@gmail.com", + "Antonio Esposito": "esposito.cloud@gmail.com", + "Dennis Dmitriev": "dis-xcom@gmail.com", +} +cpdef str __url__ = "https://github.com/python-useful-helpers/logwrap" +cpdef str __description__ = "Decorator for logging function arguments and return value by human-readable way" +cpdef str __license__ = "Apache License, Version 2.0" diff --git a/setup.py b/setup.py index 030e976..8a47be8 100644 --- a/setup.py +++ b/setup.py @@ -22,9 +22,9 @@ import collections from distutils.command import build_ext import distutils.errors +import glob import os.path import shutil -import sys try: # noinspection PyPackageRequirements @@ -44,19 +44,7 @@ long_description = f.read() -def _extension(modpath): - """Make setuptools.Extension.""" - return setuptools.Extension(modpath, [modpath.replace(".", "/") + ".py"]) - - -requires_optimization = [ - setuptools.Extension("logwrap.class_decorator", ["logwrap/class_decorator.pyx"]), - setuptools.Extension("logwrap.log_wrap", ["logwrap/log_wrap.pyx"]), - setuptools.Extension("logwrap.repr_utils", ["logwrap/repr_utils.pyx"]), -] - -if "win32" != sys.platform: - requires_optimization.append(_extension("logwrap.__init__")) +requires_optimization = [setuptools.Extension("logwrap", glob.glob("logwrap/*.pyx"))] # noinspection PyCallingNonCallable ext_modules = ( @@ -90,9 +78,7 @@ def run(self): root_dir = os.path.abspath(os.path.join(__file__, "..")) target_dir = build_dir if not self.inplace else root_dir - src_files = ( - os.path.join("logwrap", "__init__.py"), - ) + src_files = (os.path.join("logwrap", "__init__.py"),) for src_file in src_files: src = os.path.join(root_dir, src_file) @@ -233,7 +219,7 @@ def get_simple_vars_from_src(src): "setuptools >= 21.0.0,!=24.0.0," "!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2," "!=36.2.0", - "setuptools_scm" + "setuptools_scm", ], use_scm_version=True, install_requires=required,