Coverage for __main__.py : 0%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import re
2import subprocess
3import sys
4from pathlib import Path
6from shopyo.api.info import printinfo
8dirpath = Path(__file__).parent.absolute()
9dirpathparent = Path(__file__).parent.parent.absolute()
12def is_venv():
13 return hasattr(sys, "real_prefix") or (
14 hasattr(sys, "base_prefix") and sys.base_prefix != sys.prefix
15 )
18def is_valid_name(name):
19 notallowedpattern = r"[_\.]+"
20 allowedpattern = r"^[\w+\.]+$"
21 isallowed = re.match(allowedpattern, name)
22 isnotallowed = re.match(notallowedpattern, name)
24 if not isnotallowed and isallowed:
25 return True
26 else:
27 return False
30def main():
31 args = sys.argv
32 if len(args) == 1:
33 printinfo()
34 print("No arguments supplied")
35 else:
36 if not is_venv():
37 print("Please use Shopyo in a virtual environment for this command")
38 sys.exit()
39 torun = [sys.executable, "manage.py"] + args[1:]
40 subprocess.run(torun)
43if __name__ == "__main__":
44 main()