-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
87 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
__version__ = "0.0.0" |
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,18 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Setup for automated_grader package.""" | ||
from setup_utils import get_semantic_version # pylint: disable=import-error | ||
from setuptools import find_packages, setup | ||
|
||
|
||
setup( | ||
name="automated_grader", | ||
version=get_semantic_version(), | ||
description="Automated grader for Canvas environments", | ||
author="Lawrence McDaniel", | ||
author_email="[email protected]", | ||
packages=find_packages(), | ||
package_data={ | ||
"automated_grader": ["*.md", "data/*"], | ||
}, | ||
install_requires=[], | ||
) |
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,18 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Test setup.py.""" | ||
import subprocess | ||
import unittest | ||
|
||
|
||
class TestSetup(unittest.TestCase): | ||
"""Test setup.py.""" | ||
|
||
def test_setup_syntax(self): | ||
"""Test setup.py syntax.""" | ||
result = subprocess.run(["python", "setup.py", "check"], capture_output=True, text=True, check=False) | ||
assert result.returncode == 0, f"setup.py failed with output:\n{result.stdout}\n{result.stderr}" | ||
assert not result.stderr, "Expected no error output" | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
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,49 @@ | ||
# -*- coding: utf-8 -*- | ||
# pylint: disable=duplicate-code | ||
# pylint: disable=duplicate-code | ||
"""Lawrence McDaniel https://lawrencemcdaniel.com.""" | ||
import importlib.util | ||
import os | ||
import re | ||
from typing import Dict | ||
|
||
|
||
HERE = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
# allow setup.py to be run from any path | ||
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) | ||
|
||
|
||
def load_version() -> Dict[str, str]: | ||
"""Stringify the __version__ module.""" | ||
version_file_path = os.path.join(HERE, "__version__.py") | ||
spec = importlib.util.spec_from_file_location("__version__", version_file_path) | ||
version_module = importlib.util.module_from_spec(spec) | ||
spec.loader.exec_module(version_module) | ||
return version_module.__dict__ | ||
|
||
|
||
VERSION = load_version() | ||
|
||
|
||
def get_semantic_version() -> str: | ||
""" | ||
Return the semantic version number. | ||
Example valid values of __version__.py are: | ||
0.1.17 | ||
0.1.17-next.1 | ||
0.1.17-next.2 | ||
0.1.17-next.123456 | ||
0.1.17-next-major.1 | ||
0.1.17-next-major.2 | ||
0.1.17-next-major.123456 | ||
Note: | ||
- pypi does not allow semantic version numbers to contain a dash. | ||
- pypi does not allow semantic version numbers to contain a 'v' prefix. | ||
- pypi does not allow semantic version numbers to contain a 'next' suffix. | ||
""" | ||
version = VERSION["__version__"] | ||
version = re.sub(r"-next\.\d+", "", version) | ||
return re.sub(r"-next-major\.\d+", "", version) |