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

Fix for installation issues requiring sudo and no-access to etc/bash_completion.d #128

Merged
merged 3 commits into from Aug 13, 2018

Conversation

navinpai
Copy link
Contributor

@navinpai navinpai commented Aug 7, 2018

  • Create main method and update setup.py to call main as a script (which enables autocomplete)

  • Removed the now unnecessary entry in etc/bash_completion.d/


Tested on a fresh VM and in virtualenv

…ich enables autocomplete)

- Removed the now unnecessary entry in etc/bash_completion.d/
@navinpai navinpai requested a review from rozuur August 7, 2018 20:06
@navinpai
Copy link
Contributor Author

navinpai commented Aug 7, 2018

@rozuur Can you please review this pull request? It fixes the installation issues by removing the need for an entry in /etc/bash_completion.d/ which multiple people have complained about. Removing that also allows sudo-free installation. Autocomplete is handled by setup.py entry point [1]

PS The build is failed because of the encrypted env variables.

[1] http://python-packaging.readthedocs.io/en/latest/command-line-scripts.html#the-console-scripts-entry-point

@rozuur
Copy link
Contributor

rozuur commented Aug 8, 2018

Will review this week

except Exception as e:
fail('[Runtime Exception] ', exc_info=e, stacktrace=True)
def main():
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this try block required here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simply for cleaner exceptions and sticking with current behaviour. Currently only the [Error] message is printed out and process exits. But with this change the exception trace was also being printed. This simply swallows that (though verbose logging will show the exception stacktrace if needed)

@@ -1 +0,0 @@
include data/bash-completion/s4cmd
Copy link
Contributor

Choose a reason for hiding this comment

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

this is only used with sdist command used for distribution should this be removed? https://docs.python.org/2/distutils/sourcedist.html#the-manifest-in-template

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the file is deleted, it is no longer needed. When it doesn't exist the default manifest is used: https://docs.python.org/2/distutils/sourcedist.html#manifest which works for s4cmd since it's just py files which are included by default

Copy link
Contributor

@rozuur rozuur left a comment

Choose a reason for hiding this comment

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

does bash completion works with this change?

@navinpai
Copy link
Contributor Author

navinpai commented Aug 13, 2018

Yes. The bash completion is only for the s4cmd command though similar to current behaviour.

To test, installed on a fresh machine with python setup.py install in this branch (Dependencies will need to be installed seperately as pip handles this otherwise).

s4cmd.py Outdated
progress('') # Clear progress message before exit.
clean_tempfiles()
progress('') # Clear progress message before exit.
except:
Copy link
Contributor

Choose a reason for hiding this comment

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

use except Exception: instead of naked except

@navinpai
Copy link
Contributor Author

Done.

@rozuur
Copy link
Contributor

rozuur commented Aug 13, 2018

lgtm, after build success you can promote the code.

@navinpai navinpai merged commit 09c374e into bloomreach:master Aug 13, 2018
VarunWachaspati pushed a commit to VarunWachaspati/s4cmd that referenced this pull request Oct 10, 2020
…completion.d (bloomreach#128)

* - Create main method and update setup.py to call main as a script (which enables autocomplete)
- Removed the now unnecessary entry in etc/bash_completion.d/

* Delete s4cmd bash script and remove references to it

* [Minor] Catch Exception instead of naked catch
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.

None yet

2 participants