| Conditions | 2 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from coalib.bears.requirements.PackageRequirement import PackageRequirement |
||
| 26 | def install_command(self): # pragma: no cover |
||
| 27 | """ |
||
| 28 | Creates the installation command for the instance of the class. |
||
| 29 | |||
| 30 | :param return: A string with the installation command. An empty string |
||
| 31 | if the command could not be supplied. |
||
| 32 | """ |
||
| 33 | manager_dict = {'Fedora': 'dnf', |
||
| 34 | 'Ubuntu': 'apt_get', |
||
| 35 | 'Debian': 'apt_get', |
||
| 36 | 'SuSE': 'zypper', |
||
| 37 | 'redhat': 'yum', |
||
| 38 | 'arch': 'pacman'} |
||
| 39 | |||
| 40 | manager = manager_dict[platform.linux_distribution()[0]] |
||
| 41 | if manager in self.package.keys(): |
||
| 42 | result = "{} install {}".format(manager.replace("_", "-"), |
||
| 43 | self.package[manager]) |
||
| 44 | return result |
||
| 45 | else: |
||
| 46 | print('The package could not be automatically installed on your ' |
||
| 47 | 'operating system. Please try installing ' |
||
| 48 | + self.package + 'manually.') |
||
| 49 | return "" |
||
| 50 |
It is generally advisable to initialize the super-class by calling its
__init__method: