Skip to content

Commit

Permalink
Work in setuptools-scm
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Sep 6, 2022
1 parent 0c6d88b commit a733de8
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 21 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Sphinx = "*"
"flake8" = "*"
twine = "*"
moto = {extras = ["all", "ec2", "s3"], version = "*"}
setuptools-scm = "*"

[requires]
python_version = "3.9"
36 changes: 30 additions & 6 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@

A set of helpers for baking your Django site out as flat files

* Documentation: [http://django-bakery.rtfd.org](http://django-bakery.rtfd.org)
* Documentation: [palewi.re/docs/django-bakery](https://palewi.re/docs/docs/django-bakery/)
* Issues: [https://github.com/datadesk/django-bakery/issues](https://github.com/datadesk/django-bakery/issues)
* Packaging: [https://pypi.python.org/pypi/django-bakery](https://pypi.python.org/pypi/django-bakery)
* Testing: [https://travis-ci.org/datadesk/django-bakery](https://travis-ci.org/datadesk/django-bakery)
* Coverage: [https://coveralls.io/r/datadesk/django-bakery](https://coveralls.io/r/datadesk/django-bakery)
* The dream, in Powerpoint form: [http://lat.ms/bakery-talk](http://lat.ms/bakery-talk)

## Features
Expand Down
6 changes: 2 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ or require more complex views.
Contributing
------------

* Code repository: `https://github.com/datadesk/django-bakery <https://github.com/datadesk/django-bakery>`_
* Code repository: `https://palewi.re/docs/docs/django-bakery/ <https://palewi.re/docs/docs/django-bakery/>`_
* Issues: `https://github.com/datadesk/django-bakery/issues <https://github.com/datadesk/django-bakery/issues>`_
* Packaging: `https://pypi.python.org/pypi/django-bakery <https://pypi.python.org/pypi/django-bakery>`_
* Testing: `https://travis-ci.org/datadesk/django-bakery <https://travis-ci.org/datadesk/django-bakery>`_
* Coverage: `https://coveralls.io/r/datadesk/django-bakery <https://coveralls.io/r/datadesk/django-bakery>`_
* Packaging: `https://pypi.python.org/pypi/django-bakery <https://pypi.python.org/pypi/django-bakery>`_
42 changes: 34 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,31 @@ def read(file_name):
return f.read()


def version_scheme(version):
"""Version scheme hack for setuptools_scm.
Appears to be necessary to due to the bug documented here: https://github.com/pypa/setuptools_scm/issues/342
If that issue is resolved, this method can be removed.
"""
import time

from setuptools_scm.version import guess_next_version

if version.exact:
return version.format_with("{tag}")
else:
_super_value = version.format_next_version(guess_next_version)
now = int(time.time())
return _super_value + str(now)


def local_version(version):
"""Local version scheme hack for setuptools_scm.
Appears to be necessary to due to the bug documented here: https://github.com/pypa/setuptools_scm/issues/342
If that issue is resolved, this method can be removed.
"""
return ""


class TestCommand(Command):
user_options = []

Expand Down Expand Up @@ -97,7 +122,6 @@ def run(self):

setup(
name='django-bakery',
version='0.12.7',
description='A set of helpers for baking your Django site out as flat files',
long_description=read("README.md"),
long_description_content_type="text/markdown",
Expand All @@ -118,21 +142,23 @@ def run(self):
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Framework :: Django',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
'Framework :: Django :: 2.1',
'Framework :: Django :: 2',
'Framework :: Django :: 3',
'Framework :: Django :: 4',
'License :: OSI Approved :: MIT License',
],
install_requires=[
'six>1.5.2',
'boto3>=1.4.4',
'fs>=2.0.17',
],
cmdclass={'test': TestCommand}
cmdclass={'test': TestCommand},
setup_requires=["setuptools_scm"],
use_scm_version={"version_scheme": version_scheme, "local_scheme": local_version},
)

0 comments on commit a733de8

Please sign in to comment.