diff --git a/README.rst b/README.rst index e476180..770a933 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,9 @@ that offers more fully-featured integration. Installation ------------ - Included as standard in the deb packages and docker images from matrix.org. -- If you installed into a virtualenv: `pip install matrix-synapse-ldap3`. +- If you installed into a virtualenv: + - Ensure pip is up-to-date: `pip install -U pip`. + - Install the LDAP password provider: `pip install matrix-synapse-ldap3`. - For other installation mechanisms, see the documentation provided by the maintainer. Usage diff --git a/RELEASING.md b/RELEASING.md index d9f0c65..c226d4b 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -8,6 +8,8 @@ You will need push access to this repo as well as an account on PyPi with push access to the [matrix-synapse-ldap3](https://pypi.org/project/matrix-synapse-ldap3/) package. +You will need to install the `build` and `twine` packages. + 1. Edit the `__version__` variable of `ldap_auth_provider.py` to the new release version. This repository uses [Semantic Versioning](https://semver.org/). @@ -35,8 +37,8 @@ version. This repository uses [Semantic Versioning](https://semver.org/). 1. Build and upload to PyPI: ```sh - python setup.py sdist - twine upload dist/matrix-synapse-ldap3-$ver.tar.gz + python -m build + twine upload dist/matrix-synapse-ldap3-$ver.tar.gz dist/matrix_synapse_ldap3-$ver-py3-none-any.whl ``` 1. Create release on GH project page: diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..999e33d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=39.2.0", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index ab5366c..f237ab7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,21 @@ +[metadata] +name = matrix-synapse-ldap3 +url = https://github.com/matrix-org/matrix-synapse-ldap3 +version = attr: ldap_auth_provider.__version__ +description = An LDAP3 auth provider for Synapse +long_description = file: README.rst +classifiers= + Development Status :: 4 - Beta + License :: OSI Approved :: Apache Software License + Programming Language :: Python :: 3 :: Only + +[options] +install_requires = + Twisted>=15.1.0 + ldap3>=2.8 + service_identity +py_modules = ldap_auth_provider + [flake8] max-line-length = 90 # W503 requires that binary operators be at the end, not start, of lines. Erik doesn't like it. diff --git a/setup.py b/setup.py deleted file mode 100755 index 8778675..0000000 --- a/setup.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2016 OpenMarket Ltd -# -# 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. - -from setuptools import setup -from codecs import open -import os - -here = os.path.abspath(os.path.dirname(__file__)) - - -def read_file(path_segments): - """Read a UTF-8 file from the package. Takes a list of strings to join to - make the path""" - file_path = os.path.join(here, *path_segments) - with open(file_path, encoding="utf-8") as f: - return f.read() - - -def exec_file(path_segments, name): - """Extract a constant from a python file by looking for a line defining - the constant and executing it.""" - result = {} - code = read_file(path_segments) - lines = [line for line in code.split('\n') if line.startswith(name)] - exec("\n".join(lines), result) - return result[name] - - -setup( - name="matrix-synapse-ldap3", - url="https://github.com/matrix-org/matrix-synapse-ldap3", - version=exec_file(("ldap_auth_provider.py",), "__version__"), - py_modules=["ldap_auth_provider"], - description="An LDAP3 auth provider for Synapse", - install_requires=[ - "Twisted>=15.1.0", - "ldap3>=2.8", - "service_identity", - ], - test_require=[ - "matrix-synapse", - ], - long_description=read_file(("README.rst",)), - classifiers=[ - 'Development Status :: 4 - Beta', - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python :: 3 :: Only', - ], -) diff --git a/tox.ini b/tox.ini index 46a6d11..25b0039 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,6 @@ [tox] envlist = packaging, pep8, py35, py36, py37, py38 +isolated_build = True [testenv] deps =