You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.2 KiB
Python

import os
import setuptools
import subprocess
setup_dir = os.path.dirname(os.path.realpath(__file__))
def _run_command(cmd):
return subprocess.check_output(cmd, cwd=setup_dir, encoding="utf-8").strip()
def main():
with open(os.path.join(os.path.dirname(__file__), "requirements.txt"), "r") as f:
requirements = f.read().split("\n")
with open(os.path.join(os.path.dirname(__file__), "README.md"), "r") as f:
readme = f.read()
version = _run_command(["git", "rev-list", "--count", "main"])
if _run_command(["git", "status", "--porcelain"]):
# local changes here? let's force a reinstall by changing version number
find = subprocess.Popen(
["find", ".", "-type", "f"], cwd=setup_dir, stdout=subprocess.PIPE
)
xargs = subprocess.Popen(
["xargs", "sha512sum"], stdin=find.stdout, stdout=subprocess.PIPE
)
version += (
"+local."
+ subprocess.check_output(
["sha512sum"], stdin=xargs.stdout, encoding="utf-8"
)[:10]
)
setuptools.setup(
name="gradesoop",
version=version,
author="adam j hartz",
author_email="hz@mit.edu",
packages=["gradesoop", "gradesoop.commands"],
package_dir={"gradesoop": "gradesoop"},
scripts=[],
url="https://catsoop.org/git/catsoop/gradesoop",
license="AGPLv3+",
description="gradesoop: grading of printed exams within catsoop",
long_description=readme,
long_description_content_type="text/markdown",
include_package_data=True,
entry_points={"console_scripts": ["gradesoop = gradesoop.__main__:main"]},
install_requires=requirements,
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Environment :: Console",
"Environment :: Web Environment",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Intended Audience :: Education",
"Topic :: Education",
],
)
if __name__ == "__main__":
main()