-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- change update_pypi.sh accordingly
- Loading branch information
Laurent Franceschetti
committed
Oct 17, 2024
1 parent
99733be
commit 3a73707
Showing
5 changed files
with
174 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# -------------------------------------------- | ||
# Setup file for the package | ||
# | ||
# Laurent Franceschetti (c) 2018-2020 | ||
# THIS IS THE OLD VERSION, kept for reference purposes | ||
# -------------------------------------------- | ||
|
||
import os | ||
from setuptools import setup, find_packages | ||
|
||
|
||
# -------------------- | ||
# Initialization | ||
# -------------------- | ||
|
||
VERSION_NUMBER = '1.3.7' | ||
|
||
# required if you want to run document/test | ||
# pip install 'mkdocs-macros-plugin[test]' | ||
TEST_REQUIRE = ['mkdocs-macros-test', 'mkdocs-material>=6.2', | ||
'mkdocs-include-markdown-plugin', 'mkdocs-test'] | ||
|
||
# -------------------- | ||
# Setup | ||
# -------------------- | ||
|
||
|
||
def read_file(fname): | ||
"Read a local file" | ||
return open(os.path.join(os.path.dirname(__file__), fname), encoding="utf-8").read() | ||
|
||
|
||
setup( | ||
name='mkdocs-macros-plugin', | ||
version=VERSION_NUMBER, | ||
description="Unleash the power of MkDocs with macros and variables", | ||
long_description=read_file('README.md'), | ||
long_description_content_type='text/markdown', | ||
keywords='mkdocs python markdown macros', | ||
url='https://github.com/fralau/mkdocs_macros_plugin', | ||
author='Laurent Franceschbetti', | ||
author_email='[email protected]', | ||
license='MIT', | ||
python_requires='>=3.8', | ||
install_requires=[ | ||
'mkdocs>=0.17', | ||
'jinja2', | ||
'termcolor', | ||
'pyyaml', | ||
'hjson', | ||
'pathspec', | ||
'python-dateutil', | ||
'packaging', | ||
'super-collections' | ||
], | ||
extras_require={ | ||
'test': TEST_REQUIRE, | ||
}, | ||
classifiers=[ | ||
'Development Status :: 5 - Production/Stable', | ||
'Intended Audience :: Developers', | ||
'Intended Audience :: Information Technology', | ||
'License :: OSI Approved :: MIT License', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3 :: Only', | ||
'Programming Language :: Python :: 3.5', | ||
], | ||
include_package_data=True, | ||
packages=find_packages(exclude=['*.tests']), | ||
entry_points={ | ||
'mkdocs.plugins': [ | ||
'macros = mkdocs_macros.plugin:MacrosPlugin', | ||
] | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[project] | ||
name = "mkdocs-macros-plugin" | ||
|
||
# This version number is the REFERENCE for the rest of the project, | ||
# particularly for update_pypi.sh | ||
version = "1.3.6" | ||
|
||
description = "Unleash the power of MkDocs with macros and variables" | ||
readme = "README.md" | ||
license = { text = "MIT" } | ||
requires-python = ">=3.8" | ||
authors = [ | ||
{ name = "Laurent Franceschetti", email = "[email protected]" }, | ||
] | ||
keywords = [ | ||
"macros", | ||
"markdown", | ||
"mkdocs", | ||
"python", | ||
] | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Information Technology", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.5", | ||
] | ||
dependencies = [ | ||
"hjson", | ||
"jinja2", | ||
"mkdocs>=0.17", | ||
"packaging", | ||
"pathspec", | ||
"python-dateutil", | ||
"pyyaml", | ||
"super-collections", | ||
"termcolor", | ||
] | ||
|
||
[tool.setuptools] | ||
packages = { find = { exclude = ["*.tests"] } } | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
"mkdocs-include-markdown-plugin", | ||
"mkdocs-macros-test", | ||
"mkdocs-material>=6.2", | ||
"mkdocs-test", | ||
] | ||
|
||
[project.entry-points."mkdocs.plugins"] | ||
macros = "mkdocs_macros.plugin:MacrosPlugin" | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/fralau/mkdocs_macros_plugin" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,11 @@ | ||
# -------------------------------------------- | ||
# Setup file for the package | ||
# | ||
# Laurent Franceschetti (c) 2018-2020 | ||
# -------------------------------------------- | ||
|
||
import os | ||
from setuptools import setup, find_packages | ||
|
||
|
||
# -------------------- | ||
# Initialization | ||
# -------------------- | ||
|
||
VERSION_NUMBER = '1.3.6' | ||
|
||
# required if you want to run document/test | ||
# pip install 'mkdocs-macros-plugin[test]' | ||
TEST_REQUIRE = ['mkdocs-macros-test', 'mkdocs-material>=6.2', | ||
'mkdocs-include-markdown-plugin', 'mkdocs-test'] | ||
|
||
# -------------------- | ||
# Setup | ||
# -------------------- | ||
|
||
|
||
def read_file(fname): | ||
"Read a local file" | ||
return open(os.path.join(os.path.dirname(__file__), fname), encoding="utf-8").read() | ||
""" | ||
Installation using setup.py is no longer supported. | ||
Use `python -m pip install .` instead. | ||
""" | ||
|
||
from setuptools import setup | ||
|
||
# Fake reference so GitHub still considers it a real package for statistics purposes. | ||
setup( | ||
name='mkdocs-macros-plugin', | ||
version=VERSION_NUMBER, | ||
description="Unleash the power of MkDocs with macros and variables", | ||
long_description=read_file('README.md'), | ||
long_description_content_type='text/markdown', | ||
keywords='mkdocs python markdown macros', | ||
url='https://github.com/fralau/mkdocs_macros_plugin', | ||
author='Laurent Franceschbetti', | ||
author_email='[email protected]', | ||
license='MIT', | ||
python_requires='>=3.8', | ||
install_requires=[ | ||
'mkdocs>=0.17', | ||
'jinja2', | ||
'termcolor', | ||
'pyyaml', | ||
'hjson', | ||
'pathspec', | ||
'python-dateutil', | ||
'packaging', | ||
'super-collections' | ||
], | ||
extras_require={ | ||
'test': TEST_REQUIRE, | ||
}, | ||
classifiers=[ | ||
'Development Status :: 5 - Production/Stable', | ||
'Intended Audience :: Developers', | ||
'Intended Audience :: Information Technology', | ||
'License :: OSI Approved :: MIT License', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3 :: Only', | ||
'Programming Language :: Python :: 3.5', | ||
], | ||
include_package_data=True, | ||
packages=find_packages(exclude=['*.tests']), | ||
entry_points={ | ||
'mkdocs.plugins': [ | ||
'macros = mkdocs_macros.plugin:MacrosPlugin', | ||
] | ||
} | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,46 @@ | ||
# ------------------------------------------------------------- | ||
# update the package on pypi | ||
# 2024-10-12 | ||
# | ||
# Tip: if you don't want to retype pypi's username every time | ||
# define it as an environment variable (TWINE_USERNAME) | ||
# | ||
# ------------------------------------------------------------- | ||
function warn { | ||
GREEN='\033[0;32m' | ||
NORMAL='\033[0m' | ||
echo -e "${GREEN}$1${NORMAL}" | ||
} | ||
|
||
setup="python3 setup.py" | ||
package_name=$($setup --name) | ||
package_version=v$($setup --version) # add a 'v' in front (git convention) | ||
function get_value { | ||
# get the value from the config file (requires the Python toml package) | ||
toml get --toml-path pyproject.toml $1 | ||
} | ||
|
||
# Clean the subdirs, for safety and to guarantee integrity | ||
# ./cleanup.sh | ||
|
||
warn "UPDATE PACKAGE $package_name ($package_version) ON PYPI:" | ||
warn "Cleaning up..." | ||
rm -rf dist | ||
rm -rf build | ||
warn "Recreating wheels..." | ||
$setup sdist bdist_wheel 1>/dev/null | ||
# update version (just in case): | ||
package_version=v$($setup --version) # add a 'v' in front (git convention) | ||
warn "---" | ||
warn "Upload to Pypi..." | ||
if twine upload --repository-url https://upload.pypi.org/legacy/ dist/* ; then | ||
# Check for changes in the files compared to the repository | ||
if ! git diff --quiet; then | ||
warn "Won't do it: there are changes in the repository. Please commit first!" | ||
exit 1 | ||
fi | ||
|
||
# get the project inform | ||
package_name=$(get_value project.name) | ||
package_version=v$(get_value project.version) # add a 'v' in front (git convention) | ||
|
||
# update Pypi | ||
warn "Rebuilding $package_name..." | ||
rm -rf build dist *.egg-info # necessary to guarantee integrity | ||
python3 -m build | ||
if twine upload dist/* ; then | ||
git push # just in case | ||
warn "... create tag $package_version, and push to remote git repo..." | ||
git tag $package_version | ||
git push --tags | ||
warn "Done ($package_version)!" | ||
else | ||
warn "Failed ($package_version)!" | ||
fi | ||
exit 1 | ||
fi |