disable setuptools local scheme when env var is set (#551)

This commit is contained in:
Zsolt Dollenstein 2021-11-18 15:00:06 +00:00 committed by GitHub
parent 5c05001c2d
commit 2cd43c4b78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -181,6 +181,10 @@ jobs:
- name: Validate Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: exit 1
- name: Disable scmtools local scheme
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: >-
echo LIBCST_NO_LOCAL_SCHEME=1 >> $GITHUB_ENV
- name: Build a binary wheel and a source tarball
run: >-
python -m

View file

@ -4,7 +4,7 @@
# LICENSE file in the root directory of this source tree.
from os import path
from os import path, environ
import setuptools
@ -13,9 +13,19 @@ this_directory: str = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, "README.rst"), encoding="utf-8") as f:
long_description: str = f.read()
def no_local_scheme(version: str) -> str:
return ""
setuptools.setup(
use_scm_version={
"write_to": "libcst/_version.py",
**(
{"local_scheme": no_local_scheme}
if "LIBCST_NO_LOCAL_SCHEME" in environ
else {}
),
},
name="libcst",
description="A concrete syntax tree with AST-like properties for Python 3.5, 3.6, 3.7 and 3.8 programs.",