|
1 | 1 | # Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) |
2 | 2 |
|
3 | | -style: |
4 | | - black src/mapillary && flake8 src/mapillary |
| 3 | +define PYTHON_SCRIPT |
5 | 4 |
|
| 5 | +import os |
| 6 | +import sys |
| 7 | + |
| 8 | +sys.path.insert(0, os.path.abspath('../')) |
| 9 | + |
| 10 | + |
| 11 | +def skip(app, what, name, obj, would_skip, options): |
| 12 | + '''Skip''' |
| 13 | + |
| 14 | + extensions.append('sphinx_autodoc_typehints') |
| 15 | + |
| 16 | + if name in ('__init__',): |
| 17 | + return False |
| 18 | + return would_skip |
| 19 | + |
| 20 | + |
| 21 | + def setup(app): |
| 22 | + '''Setup App''' |
| 23 | + |
| 24 | + app.connect('autodoc-skip-member', skip) |
| 25 | +endef |
| 26 | + |
| 27 | +# SETUP |
| 28 | + |
| 29 | +# # Setup all |
| 30 | +setup: setup-prod setup-dev |
| 31 | + |
| 32 | +# # Install needed dependencies |
| 33 | +setup-prod: |
| 34 | + python -m pip install --upgrade pip |
| 35 | + pip install pipenv |
| 36 | + pipenv install |
| 37 | + |
| 38 | +# # Install developer dependencies |
| 39 | +setup-dev: |
| 40 | + python -m pip install --upgrade pip |
| 41 | + pip install pipenv |
| 42 | + pipenv install --dev |
| 43 | + |
| 44 | +# PACKAGE BUILD |
| 45 | + |
| 46 | +# # Build the package |
| 47 | +build: |
| 48 | + # Builds the package distributions |
| 49 | + python3 setup.py sdist bdist_wheel --universal |
| 50 | + |
| 51 | +local-install: |
| 52 | + # Locally install mapillary - DO THIS ONLY AFTER RUNNING `make build` |
| 53 | + pip3 install -e . |
| 54 | + |
| 55 | +# CODE QUALITY |
| 56 | + |
| 57 | +# # Styling related |
| 58 | +style: format lint |
| 59 | + |
| 60 | +# # # Formatting |
| 61 | +format: |
| 62 | + @ black src/mapillary |
| 63 | + |
| 64 | +# # # Linting |
| 65 | +lint: |
| 66 | + @ # stop the build if there are Python syntax errors or undefined names |
| 67 | + @ flake8 src/mapillary --count --select=E9,F63,F7,F82 --show-source --statistics |
| 68 | + |
| 69 | + @ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 70 | + @ flake8 src/mapillary --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 71 | + |
| 72 | +# DOCUMENTATION |
| 73 | + |
| 74 | +# # For generating the latest developer documentation from src/mapillary |
| 75 | +# # and serving them locally with Docusaurus |
| 76 | +docs-gen: docs-sphinx docs-py docs-start |
| 77 | + |
| 78 | +# # # Sphinx Documentation Generation |
| 79 | +docs-sphinx: |
| 80 | + sphinx-apidoc -o sphinx-docs ./src/ sphinx-apidoc --full -A 'Mapillary'; cd sphinx-docs; echo "$$PYTHON_SCRIPT" >> conf.py; make markdown; |
| 81 | + |
| 82 | +# # # Python Script for moving markdown from sphinx -> docusaurus |
| 83 | +docs-py: |
| 84 | + python3 scripts/documentation.py |
| 85 | + |
| 86 | +# # # Serve the newly generated documentation |
| 87 | +docs-start: |
| 88 | + cd docs; npm run start; |
| 89 | + |
| 90 | +# # For pushing the docs to the gh-pages branch |
| 91 | +docs-push: docs-build docs-deploy |
| 92 | + |
| 93 | +# # # Building the static pages |
| 94 | +docs-build: |
| 95 | + # Building the documentation |
| 96 | + cd docs; npm run build; |
| 97 | + |
| 98 | +# # # Deploying the documentation to gh-pages |
| 99 | +docs-deploy: |
| 100 | + # Deploying the documentation |
| 101 | + # Deploying requires GIT_USER's password and write access to the repository |
| 102 | + # If normal password authentication is used, deployment fails |
| 103 | + # remote: Support for password authentication was removed on August 13, 2021. |
| 104 | + # Please use a personal access token instead. See here for more information |
| 105 | + # https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ |
| 106 | + cd docs; GIT_USER=Rubix982 yarn deploy; |
| 107 | + |
| 108 | +# CLEANING |
| 109 | + |
| 110 | +# # Removing temporary created artifacts |
| 111 | +clean: sphinx-docs-clean docs-clean build-clean |
| 112 | + |
| 113 | +# # # Remove Sphinx Documentation |
| 114 | +sphinx-docs-clean: |
| 115 | + rm -rf sphinx-docs/ |
| 116 | + |
| 117 | +# # # Remove latest build of docs |
| 118 | +docs-clean: |
| 119 | + rm -rf docs/build |
| 120 | + |
| 121 | +# # # Remove latest sr/mapillary build |
| 122 | +build-clean: |
| 123 | + rm -rf build/ dist/ |
| 124 | + |
| 125 | +# TESTING |
| 126 | + |
| 127 | +# # Execute pytest on tests/ |
6 | 128 | test: |
7 | 129 | @ pytest --log-cli-level=20 |
0 commit comments