6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-04 19:03:39 +00:00

fix: make sure that tutor-openedx is an empty package

Previously, the tutor-openedx package was loading tons of template data from
the MANIFEST.in. Turns out, we cannot ignore the MANIFEST.in file with
setuptools. So we need to move tutor-openedx to a separate, dedicated folder.
To auto-discover the package version, we copy it at runtime (in the make
command).
This commit is contained in:
Régis Behmo 2021-07-06 09:42:57 +02:00
parent db5852e9c4
commit 8be574aac8
6 changed files with 23 additions and 13 deletions

3
.gitignore vendored
View File

@ -7,3 +7,6 @@ __pycache__
/build/
/dist/
/release_description.md
# Copied at build-time
/tutor-openedx/tutoropenedx/__about__.py

View File

@ -1,6 +1,6 @@
.DEFAULT_GOAL := help
.PHONY: docs
SRC_DIRS = ./tutor ./tests ./bin
SRC_DIRS = ./tutor ./tests ./bin ./tutor-openedx
BLACK_OPTS = --exclude templates ${SRC_DIRS}
###### Development
@ -18,9 +18,14 @@ upgrade-requirements: ## Upgrade requirements files
pip-compile --upgrade requirements/dev.in
pip-compile --upgrade requirements/docs.in
build-pythonpackage: ## Build a python package ready to upload to pypi
build-pythonpackage: build-pythonpackage-tutor build-pythonpackage-tutor-openedx ## Build python packages ready to upload to pypi
build-pythonpackage-tutor: ## Build the "tutor" python package for upload to pypi
python setup.py sdist
python setup-obsolete.py sdist
build-pythonpackage-tutor-openedx: ## Build the obsolete "tutor-openedx" python package for upload to pypi
cp tutor/__about__.py tutor-openedx/tutoropenedx/
cd tutor-openedx && python setup.py sdist --dist-dir ../dist
push-pythonpackage: ## Push python package to pypi
twine upload --skip-existing dist/tutor-$(shell make version).tar.gz
@ -42,6 +47,7 @@ test-types: ## Check type definitions
test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
twine check dist/tutor-$(shell make version).tar.gz
twine check dist/tutor-openedx-$(shell make version).tar.gz
format: ## Format code automatically
black $(BLACK_OPTS)

View File

3
tutor-openedx/README.rst Normal file
View File

@ -0,0 +1,3 @@
WARNING: This project has moved to https://pypi.org/project/tutor/. You should now install Tutor with::
pip install tutor

View File

@ -1,24 +1,20 @@
import io
import os
import sys
from setuptools import setup
HERE = os.path.abspath(os.path.dirname(__file__))
def load_readme():
return """
WARNING: This project has moved to https://pypi.org/project/tutor/. You should now install Tutor with::
pip install tutor
"""
with io.open(os.path.join(HERE, "README.rst"), "rt", encoding="utf8") as f:
return f.read()
def load_about():
about = {}
with io.open(
os.path.join(HERE, "tutor", "__about__.py"), "rt", encoding="utf-8"
os.path.join(HERE, "tutoropenedx", "__about__.py"), "rt", encoding="utf-8"
) as f:
exec(f.read(), about) # pylint: disable=exec-used
return about
@ -42,7 +38,7 @@ setup(
description="The Docker-based Open edX distribution designed for peace of mind",
long_description=load_readme(),
long_description_content_type="text/x-rst",
packages=[],
packages=["tutoropenedx"],
python_requires=">=3.5",
install_requires=["tutor=={}".format(ABOUT["__version__"])],
classifiers=[
@ -59,8 +55,10 @@ setup(
"Programming Language :: Python :: 3.10",
],
)
sys.stderr.write("""
sys.stderr.write(
"""
Installing Tutor from tutor-openedx is deprecated. You should instead install the "tutor" package with:
pip install tutor
""")
"""
)

View File