| Conditions | 2 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from coalib.bears.requirements.PackageRequirement import PackageRequirement |
||
| 22 | def install_command(self): |
||
| 23 | """ |
||
| 24 | Creates the installation command for the instance of the class. |
||
| 25 | |||
| 26 | :param return: A string with the installation command. |
||
| 27 | """ |
||
| 28 | manager_dict = {'Fedora': 'dnf', |
||
| 29 | 'Ubuntu': 'apt-get', |
||
| 30 | 'Debian': 'apt-get', |
||
| 31 | 'SuSE': 'zypper', |
||
| 32 | 'redhat': 'yum', |
||
| 33 | 'arch': 'pacman'} |
||
| 34 | |||
| 35 | if platform.linux_distribution()[0] in manager_dict: |
||
| 36 | self.manager = manager_dict[platform.linux_distribution()] |
||
| 37 | else: |
||
| 38 | print('The package could not be automatically installed on your' |
||
| 39 | 'operating system. Please try installing ' |
||
| 40 | + self.package + 'manually.') |
||
| 41 | |||
| 42 | result = "{} install {}".format(self.manager, self.package) |
||
| 43 | return result |
||
| 44 |