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

import sys 

from pathlib import Path 

 

 

class Requirements: 

DEVELOPER_INSTALL="developer" 

NORMAL_INSTALL="normal" 

REQUIREMENTS = { 

DEVELOPER_INSTALL: "developer_installation.txt", 

NORMAL_INSTALL: "normal_installation.txt", 

} 

def __init__(self, package_path): 

assert package_path.is_dir() 

self.package_path = package_path 

 

self.src_path = Path(sys.prefix, "src") 

src_pylucid_path = Path(self.src_path, "pylucid") 

18 ↛ 22line 18 didn't jump to line 22, because the condition on line 18 was never false if src_pylucid_path.is_dir(): 

print("PyLucid is installed as editable here: %s" % src_pylucid_path) 

self.install_mode=self.DEVELOPER_INSTALL 

else: 

print("PyLucid is installed as packages here: %s" % self.package_path) 

self.install_mode=self.NORMAL_INSTALL 

 

@property 

def normal_mode(self): 

return self.install_mode == self.NORMAL_INSTALL 

 

def get_requirement_path(self): 

""" 

:return: Path(.../pylucid/requirements/) 

""" 

requirement_path = Path(self.package_path, "requirements").resolve() 

34 ↛ 35line 34 didn't jump to line 35, because the condition on line 34 was never true if not requirement_path.is_dir(): 

raise RuntimeError("Requirements directory not found here: %s" % requirement_path) 

return requirement_path 

 

def get_requirement_file_path(self): 

""" 

:return: Path(.../pylucid/requirements/<mode>_installation.txt) 

""" 

requirement_path = self.get_requirement_path() 

filename = self.REQUIREMENTS[self.install_mode] 

 

requirement_file_path = Path(requirement_path, filename).resolve() 

46 ↛ 47line 46 didn't jump to line 47, because the condition on line 46 was never true if not requirement_file_path.is_file(): 

raise RuntimeError("Requirements file not found here: %s" % requirement_file_path) 

 

return requirement_file_path 

 

 

if __name__ == '__main__': 

import pylucid 

package_path = Path(pylucid.__file__).parent 

req = Requirements(package_path=package_path) 

print("requirement_path.......:", req.get_requirement_path()) 

print("requirement_file_path..:", req.get_requirement_file_path())