Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portability Fixes #8

Merged
merged 10 commits into from
Nov 10, 2018
Merged

Portability Fixes #8

merged 10 commits into from
Nov 10, 2018

Conversation

rathod-sahaab
Copy link
Contributor

Significant>
Added support different package manager based on their availability,
rather than based on distrribution in use.

Also>
Added print_clr() to avoid ambiguities on non-error printed as errors,
rather than print_err() which writes on 'stderr', for colour.

abhay-recon and others added 2 commits October 18, 2018 23:52
	Added support different package manager based on their availability,
	rather than based on distro in use.

>Also>
	Added print_clr() to avoid ambiguities on non-error printed as errors,
	rather than print_err() which writes on 'stderr', for colour.
Copy link
Owner

@srbcheema1 srbcheema1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done @mr-rathod,
I really appreciate the approach of package-managers.
I have made some comments on design changes.
please have a look on them

coolkit/dependencies/dependency.py Outdated Show resolved Hide resolved
coolkit/dependencies/dependency.py Outdated Show resolved Hide resolved
coolkit/dependencies/dependency.py Show resolved Hide resolved
coolkit/dependencies/dependency.py Outdated Show resolved Hide resolved
for rules in dependency_map.values():
for key in rules.keys():
package_managers.add(key)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return package_managers.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep it like your are returning supported package managers. not any one of them.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and make changes accrodingly in install_dependencies

-Standardisation of names
-Support for multiple package  mangers
-got rid of extra whitespaces
Copy link
Owner

@srbcheema1 srbcheema1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good work @mr-rathod ,
I have made few reviews. please address them as soon as posssible.
I am looking forward to make a new release as soon as possible.

'dnf':'sudo dnf install python-argcomplete',#fedora
'zypper':'sudo zypper install python-argcomplete',#suse
},
'figlet':{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hei remove figlet. that was just for testing purpose.


supported_package_managers = set()
for package_manager in package_managers :
if is_installed(package_manager) :
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mr-rathod please dont check for installed ones in this method.
as per name of this method _get_supported_package_managers it has to return list of supported ones not available ones.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will have to create a new method def _install_dependency(supported_package_managers):

all_installed = True
package_managers = _get_supported_package_managers(dependency_map)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this variable name to supported_package_managers

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may get available_package_managers list in from another method which will take supported_package_managers as input.

package_managers = _get_supported_package_managers(dependency_map)

#--handling-absence-of-package-managers--
if len(package_managers)==0 :
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if len(available_package_managers) == 0:

print_clr('.:Installing ' + C.E + dependency + C.G +' dependency' , C.G) #distinction of dependency

for package_manger in package_managers :
os.system(rules[package_manager])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only run rules of available_package_managers

rule_map = dependency_map[dependency]
for package_manager in available_package_manager:
     if(package_manager in rule_map):
         os.system(......)
         .....
    


if not is_installed(dependency):
print_err('please install ' + dependency + ' dependency manually',C.Y)
for package_manager in package_managers :
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for package_manager in available_package_managers:

Available package managers are selected from supported package
managers for each dependency in dependency map
coolkit/dependencies/dependency.py Outdated Show resolved Hide resolved
coolkit/dependencies/dependency.py Outdated Show resolved Hide resolved
coolkit/dependencies/dependency.py Outdated Show resolved Hide resolved
Copy link
Owner

@srbcheema1 srbcheema1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the PR looks good to me, I have requested some changes. most of them are minor code polishing changes. Most of the changes I suggested are github suggestions so you can apply them from online just click on apply change. after you update the PR I will test it and merge it :)

srbcheema1 and others added 5 commits November 11, 2018 00:52
Co-Authored-By: Mr-Rathod <abhayonlyone@gmail.com>
Co-Authored-By: Mr-Rathod <abhayonlyone@gmail.com>
Co-Authored-By: Mr-Rathod <abhayonlyone@gmail.com>
actions are now handled together rather than prompts
@srbcheema1
Copy link
Owner

Well done @mr-rathod , I am merging this PR :)
I would be glad to see more contributions from your side.

@srbcheema1 srbcheema1 merged commit de815f6 into srbcheema1:master Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants