Hide keyboard shortcuts

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

#!/usr/bin/python3 

 

""" 

PyLucid Admin Shell 

~~~~~~~~~~~~~~~~~~~ 

 

:created: 2018 by Jens Diemer 

:copyleft: 2018 by the PyLucid team, see AUTHORS for more details. 

:license: GNU GPL v3 or above, see LICENSE for more details. 

""" 

 

import logging 

import os 

from pathlib import Path 

 

# Bootstrap-Env 

import pylucid 

from pylucid.admin_shell.normal_shell import PyLucidNormalShell 

from pylucid.admin_shell.requirements import Requirements 

 

log = logging.getLogger(__name__) 

 

SELF_FILE_PATH=Path(pylucid.__file__).resolve() # .../src/pylucid/pylucid/__init__.py 

PACKAGE_PATH=Path(SELF_FILE_PATH.parent).resolve() # .../src/pylucid/pylucid/ 

BOOT_FILE_PATH=Path(PACKAGE_PATH, "pylucid_boot.py").resolve() # .../src/pylucid/pylucid/pylucid_boot.py 

OWN_FILE_NAME=Path(__file__).name # pylucid_admin.py 

 

assert SELF_FILE_PATH.is_file() 

assert PACKAGE_PATH.is_dir() 

assert BOOT_FILE_PATH.is_file() 

 

# print("SELF_FILE_PATH: %s" % SELF_FILE_PATH) 

# print("BOOT_FILE_PATH: %s" % BOOT_FILE_PATH) 

# print("PACKAGE_PATH: %s" % PACKAGE_PATH) 

# print("OWN_FILE_NAME: %s" % OWN_FILE_NAME) 

 

 

TEST_REQ_FILE_NAME="test_requirements.txt" 

 

 

 

def main(): 

assert "VIRTUAL_ENV" in os.environ, "ERROR: Call me only in a activated virtualenv!" 

 

requirements = Requirements(package_path=PACKAGE_PATH) 

 

47 ↛ 49line 47 didn't jump to line 49, because the condition on line 47 was never true if requirements.normal_mode: 

# Installed in "normal" mode (as Package from PyPi) 

ShellClass = PyLucidNormalShell 

else: 

# Installed in "developer" mode (as editable from source) 

# Import here, because developer_shell imports packages that 

# only installed in "developer" mode ;) 

from pylucid.admin_shell.developer_shell import PyLucidDeveloperShell 

ShellClass = PyLucidDeveloperShell 

 

ShellClass( 

requirements=requirements, 

self_filename=OWN_FILE_NAME, 

package_path = PACKAGE_PATH, 

).cmdloop() 

 

 

if __name__ == '__main__': 

main()