7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-05-30 21:00:49 +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/ /build/
/dist/ /dist/
/release_description.md /release_description.md
# Copied at build-time
/tutor-openedx/tutoropenedx/__about__.py

View File

@ -1,6 +1,6 @@
.DEFAULT_GOAL := help .DEFAULT_GOAL := help
.PHONY: docs .PHONY: docs
SRC_DIRS = ./tutor ./tests ./bin SRC_DIRS = ./tutor ./tests ./bin ./tutor-openedx
BLACK_OPTS = --exclude templates ${SRC_DIRS} BLACK_OPTS = --exclude templates ${SRC_DIRS}
###### Development ###### Development
@ -18,9 +18,14 @@ upgrade-requirements: ## Upgrade requirements files
pip-compile --upgrade requirements/dev.in pip-compile --upgrade requirements/dev.in
pip-compile --upgrade requirements/docs.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.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 push-pythonpackage: ## Push python package to pypi
twine upload --skip-existing dist/tutor-$(shell make version).tar.gz 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 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-$(shell make version).tar.gz
twine check dist/tutor-openedx-$(shell make version).tar.gz
format: ## Format code automatically format: ## Format code automatically
black $(BLACK_OPTS) 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 io
import os import os
import sys import sys
from setuptools import setup from setuptools import setup
HERE = os.path.abspath(os.path.dirname(__file__)) HERE = os.path.abspath(os.path.dirname(__file__))
def load_readme(): def load_readme():
return """ with io.open(os.path.join(HERE, "README.rst"), "rt", encoding="utf8") as f:
WARNING: This project has moved to https://pypi.org/project/tutor/. You should now install Tutor with:: return f.read()
pip install tutor
"""
def load_about(): def load_about():
about = {} about = {}
with io.open( 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: ) as f:
exec(f.read(), about) # pylint: disable=exec-used exec(f.read(), about) # pylint: disable=exec-used
return about return about
@ -42,7 +38,7 @@ setup(
description="The Docker-based Open edX distribution designed for peace of mind", description="The Docker-based Open edX distribution designed for peace of mind",
long_description=load_readme(), long_description=load_readme(),
long_description_content_type="text/x-rst", long_description_content_type="text/x-rst",
packages=[], packages=["tutoropenedx"],
python_requires=">=3.5", python_requires=">=3.5",
install_requires=["tutor=={}".format(ABOUT["__version__"])], install_requires=["tutor=={}".format(ABOUT["__version__"])],
classifiers=[ classifiers=[
@ -59,8 +55,10 @@ setup(
"Programming Language :: Python :: 3.10", "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: Installing Tutor from tutor-openedx is deprecated. You should instead install the "tutor" package with:
pip install tutor pip install tutor
""") """
)

View File