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

Package the AWS command-line as a "console script" entry point #5063

Closed
danizen opened this issue Mar 13, 2020 · 5 comments · May be fixed by #9212
Closed

Package the AWS command-line as a "console script" entry point #5063

danizen opened this issue Mar 13, 2020 · 5 comments · May be fixed by #9212
Labels
closed-for-staleness feature-request A feature should be added or improved. installation

Comments

@danizen
Copy link

danizen commented Mar 13, 2020

DESIRED BEHAVIOR

The aws command on Windows should be an EXE rather than a batch file, because Python supports that well, and it is low-hanging fruit.

CURRENT BEHAVIOR

aws is a batch file, and this limits how it can be integrated with some build systems.

AN EASY FIX?

This could be addressed with changes to setup.py, depending on how this affects Python 2.7 support. Python 2 is end of life, and on Windows, Python 2.7's install does not even include pip.

    entry_points={'console_scripts': [
        'aws = awscli.clidriver:main',
    ]},

MOTIVATING EXAMPLE

This should work:

    <target name="deploy"
            description="--> Upload the S3 file to Amazon S3">        
        <exec failonerror="true" executable="aws">
            <arg value="s3" />
            <arg value="cp" />
            <arg value="${target.file}" />
            <arg value="${bucket.path}" />
        </exec>
    </target>

Since aws is a bat file rather than an executable, this fails on Windows.

@kdaily
Copy link
Member

kdaily commented Sep 23, 2020

Hi @danizen, thanks. I looked at the installations via MSI for the AWS CLI v1 and v2, and both of these have an exe. By default, these are available at C:\Program Files\Amazon\AWSCLI\aws.exe and C:\Program Files\Amazon\AWSCLIV2\aws.exe, respectively for V1 and V2. Can you describe how you are installing? Can you provide a little more details as to which build systems you've encountered difficulty with?

@kdaily kdaily added guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Sep 23, 2020
@github-actions
Copy link

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Sep 30, 2020
@danizen
Copy link
Author

danizen commented Sep 30, 2020

@kdaily, the issue and suggestion is for the Python packaging, rather than the MSI packaging. No one I know installs Python packages as MSIs, indeed most of my developers would be unable to do that, because they do not have administrative permissions. I, and my programmers, are installing it as follows:

pip install awscli

The code at

scripts=['bin/aws', 'bin/aws.cmd',
is a very old way of setting up scripts that does not work properly on Windows. The newer way is to use the console_scripts entry point. The example below does this just for the main command-line - the other scripts, which are more specific to Linux shells such as bash and zsh, should remain as they are.

    entry_points={'console_scripts': [
        'aws = awscli.clidriver:main',
    ]},

Here is the documentation, but what they do not say is that for Linux/Mac, pip installs an executable script, but for Windows, it creates an exe file that loads Python though DLLs and then executes the correct Python module.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Sep 30, 2020
@kdaily kdaily added feature-request A feature should be added or improved. installation and removed guidance Question that needs advice or information. labels Sep 30, 2020
@github-actions
Copy link

github-actions bot commented Oct 1, 2021

Greetings! It looks like this issue hasn’t been active in longer than one year. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Oct 1, 2021
@github-actions github-actions bot closed this as completed Oct 3, 2021
@tomjakubowski
Copy link

+1. This would make it easier to use the aws cli from Bazel, using py_console_script_binary

gholms added a commit to gholms/aws-cli that referenced this issue Jan 14, 2025
In comparison to `scripts`, setuptools's `console_scripts` mechanism is
a more portable way to register CLI executables which allows setuptools
to generate the executable stub script in a manner appropriate for the
platform in question.  It also integrates well with bazel.  In this
patch we add one for the `aws` command.

Fixes aws#5063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness feature-request A feature should be added or improved. installation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants