This file contains hidden or 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
.PHONY: upload | |
upload: | |
$(RUN_DOCK) "twine upload ~/$(MODULE_NAME)/dist/$(MODULE_NAME)-$(MODULE_VERSION)*" |
This file contains hidden or 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
import os | |
import re | |
import setuptools | |
envstring = lambda var: os.environ.get(var) or "" | |
try: | |
with open("README.md", "r") as fh: | |
long_description = fh.read() | |
except: |
This file contains hidden or 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
# export vars to environment | |
if [ -s ~/${MODULE_NAME}/variables ]; then | |
set -a | |
. ~/${MODULE_NAME}/variables | |
set +a | |
fi |
This file contains hidden or 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
.PHONY: module | |
module: | |
@# ensure there is a symlink from MODULE_NAME to module directory | |
@# then run regular setup.py to build the module | |
$(RUN_DOCK) "cd ~/$(MODULE_NAME) \ | |
&& find ./ -type l -maxdepth 1 |xargs rm -f \ | |
&& ln -sf module "$(MODULE_NAME)" \ | |
&& python3 setup.py sdist" | |
.PHONY: pylint |
This file contains hidden or 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
.PHONY: fork | |
FILES = \ | |
module files Makefile Dockerfile docker-compose.yml setup.py MANIFEST.in variables .gitignore .pylintrc | |
DEST ?= $(dest) | |
fork: | |
ifeq ($(DEST),) | |
@echo 'MISSING "dest=" PARAMETER' | |
@echo 'RUN: make fork dest=$${DIRECTORY}' | |
else | |
@# copy when either directory does not exist, or is empty |
This file contains hidden or 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
NAME=${YOUR_MODULE_NAME} | |
VERSION=${VERSION_OF_YOUR_MODULE} | |
AUTHOR="${YOUR_NAME_OR_ALIAS}" | |
AUTHOR_EMAIL="${YOUR_EMAIL_ACCOUNT}" | |
DESCRIPTION="${WHAT_YOUR_MODULE_DOES}" | |
URL="${GIT_REPOSITORY_URL}" |
This file contains hidden or 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
# Retrieve a variable from a file in to Makefile | |
# Strips off any quotes as well, \47 represents a strong-quote | |
MODULE_NAME = \ | |
$(shell awk -F= '/^NAME\ ?=/{gsub(/\47|"/, "", $$NF);print $$NF;exit}' variables) |
This file contains hidden or 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
" command W !git diff-index --quiet HEAD || git commit -am auto | |
" autocmd BufWritePost * call AutoCommit() | |
command W call AutoCommit() | |
function! AutoCommit() | |
execute ':w' | |
call system('git rev-parse --git-dir > /dev/null 2>&1') | |
if v:shell_error | |
return | |
endif | |
let message = '__auto_update__:' . expand('%:.') |
This file contains hidden or 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
FROM alpine as base | |
RUN apk update \ | |
&& apk add --no-cache \ | |
bash | |
FROM scratch as user | |
COPY --from=base . . | |
ARG HOST_UID=${HOST_UID:-4000} |
This file contains hidden or 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
version: '3.4' | |
services: | |
main: | |
# Makefile fills PROJECT_NAME to current directory name. | |
# add UID to allow multiple users run this in parallel | |
container_name: ${PROJECT_NAME}_${HOST_UID:-4000} | |
hostname: ${PROJECT_NAME} | |
# These variables are passed into the container. | |
environment: | |
- UID=${HOST_UID:-4000} |
NewerOlder