Giter Club home page Giter Club logo

p's Introduction

Hi there 👋

p's People

Contributors

blha303 avatar professorjamesmoriarty avatar qw3rtman avatar royxue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

p's Issues

Space in url for download of python sources prevents download of python sources.

in commit 8459aea
Because the url now contains a space in the version directory, the fetch gets the directory https://www.python.org/ftp/python/ instead of the intended 2.7.10/Python-2.7.10.tgz. gzip fails because the directory listing is not the intended tgz file.
Test results and patch included.

run_test 2.7.10


P_PREFIX: /home/pac1/work/testp_dir
Test command: /home/pac1/work/p/bin/p 2.7.10

 install : Python-2.7.10
  create : /home/pac1/work/testp_dir/p/versions/python/2.7.10
   fetch : https://www.python.org/ftp/python/ 2.7.10/Python-2.7.10.tgz
################################################################## 100.0%

gzip: stdin: not in gzip format
tar: Child returned status 1
configure : 2.7.10
compile : 2.7.10

Error: Unable to compile Python 2.7.10!

Note that after the error in the download, the script continued to run.

Attached Patch applied

Result This issue is fixed but issue #11 is still there:

run_test 2.7.10


P_PREFIX: /home/pac1/work/testp_dir
Test command: /home/pac1/work/p/bin/p 2.7.10

 install : Python-2.7.10
  create : /home/pac1/work/testp_dir/p/versions/python/2.7.10
   fetch : https://www.python.org/ftp/python//2.7.10/Python-2.7.10.tgz

configure : 2.7.10
compile : 2.7.10

Error: Unable to compile Python 2.7.10!

Installed Python

I have Python2 and Python3 installed on my system using package management. Is there a way for p to have something like p system to use system installed version?

npm package: pyvm maybe need publish again

Hi,
I got this error after npm i -g pyvm

image

I found there is a redundant space character.

and I found the code in node_modules is wrong:
image

You have fixed this error:2398fa5

The code on the github is right, but npm package code is wrong, maybe need to publish again.

Regards

directory layout - "compatibility"

for folks coming from pyenv it'd be great to be able to continue to use the directory structure it is supposing/using. i tried a bit of symlinking and/or setting BASE_VERSIONS_DIR without any obvious effect.

Shellcheck warnings

Out of habit I ran ShellCheck over p, as it's quite a large shell script and bash is hard to write well.

While ShellCheck does tend to highlight things that aren't actually bugs, it did point out a few things that are problematic.

Output from shellcheck p.sh below:

In p.sh line 31:
test -d $BASE_VERSIONS_DIR/python || mkdir -p $BASE_VERSIONS_DIR/python
        ^-- SC2086: Double quote to prevent globbing and word splitting.
                                              ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 46:
    printf "\n  \033[31mError: $@\033[0m\n\n" && exit 1
           ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
                               ^-- SC2145: Argument mixes string and array. Use * or separate argument.

In p.sh line 54:
    printf "\n  \033[32mSuccess: $@\033[0m\n\n"
           ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
                                 ^-- SC2145: Argument mixes string and array. Use * or separate argument.

In p.sh line 134:
    log version $current
                ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 135:
    log bin $(display_bin_path_for_version)
            ^-- SC2046: Quote this to prevent word splitting.

In p.sh line 136:
    log previous $(get_previous_version)
                 ^-- SC2046: Quote this to prevent word splitting.

In p.sh line 137:
    log latest $(is_latest_version)
               ^-- SC2046: Quote this to prevent word splitting.

In p.sh line 138:
    log stable $(is_latest_stable_version)
               ^-- SC2046: Quote this to prevent word splitting.

In p.sh line 162:
    list_versions_installed | grep $selected -A 1 | tail -n 1
                                   ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 170:
    list_versions_installed | grep $selected -B 1 | head -n 1
                                   ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 177:
    if [ ! -f $BASE_VERSIONS_DIR/.prev ]; then
              ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 180:
        echo $(cat $BASE_VERSIONS_DIR/.prev)
             ^-- SC2046: Quote this to prevent word splitting.
             ^-- SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
                   ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 197:
    local version=$(python -V 2>&1)
          ^-- SC2155: Declare and assign separately to avoid masking return values.

In p.sh line 210:
            $BASE_VERSIONS_DIR/python/$current/python.exe \
            ^-- SC2086: Double quote to prevent globbing and word splitting.
                                      ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 211:
            $(which python) ; then
            ^-- SC2046: Quote this to prevent word splitting.

In p.sh line 222:
    find $BASE_VERSIONS_DIR -maxdepth 2 -type d \
         ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 223:
        | sed 's|'$BASE_VERSIONS_DIR'/||g' \
                  ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 238:
            printf "  \033[36mο\033[0m $version_minus_python\033[0m\n"
                   ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".

In p.sh line 240:
            printf "    \033[90m$version_minus_python\033[0m\n"
                   ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".

In p.sh line 252:
        echo ${version}
             ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 263:
    display_versions_with_selected $active
                                   ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 273:
            display_versions_with_selected $(prev_version_installed)
                                           ^-- SC2046: Quote this to prevent word splitting.

In p.sh line 277:
            display_versions_with_selected $(next_version_installed)
                                           ^-- SC2046: Quote this to prevent word splitting.

In p.sh line 280:
            activate $selected
                     ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 301:
    curl -Is $1 | head -n 1 | grep 200 > /dev/null
             ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 310:
    echo "${MIRROR}${version_directory%b*}/Python-${version}.tgz"
          ^-- SC2128: Expanding an array without an index only gives the first element.

In p.sh line 321:
        echo $active > $BASE_VERSIONS_DIR/.prev
             ^-- SC2086: Double quote to prevent globbing and word splitting.
                       ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 323:
        ln -sf $BASE_VERSIONS_DIR/$version/python.exe $BASE_VERSIONS_DIR/python/python
               ^-- SC2086: Double quote to prevent globbing and word splitting.
                                  ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                      ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 332:
    test -f $BASE_VERSIONS_DIR/.prev || abort "no previous versions activated"
            ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 333:
    local prev=$(cat $BASE_VERSIONS_DIR/.prev)
          ^-- SC2155: Declare and assign separately to avoid masking return values.
                     ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 334:
    test -d $BASE_VERSIONS_DIR/$prev || abort "previous version $prev not installed"
            ^-- SC2086: Double quote to prevent globbing and word splitting.
                               ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 335:
    activate $prev
             ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 338:
    log activate $current
                 ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 350:
    rm -rf $BASE_VERSIONS_DIR/python/python
           ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 363:
    local dots=$(echo $version | sed 's/[^.]*//g')
          ^-- SC2155: Declare and assign separately to avoid masking return values.
                      ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 365:
        version=$($GET 2> /dev/null ${MIRROR} \
                                    ^-- SC2128: Expanding an array without an index only gives the first element.
                                    ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 370:
            | egrep ^$version \
                     ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 373:
        test $version || abort "invalid version ${1#v}"
             ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 377:
    local url=$(tarball_url $version)
          ^-- SC2155: Declare and assign separately to avoid masking return values.
                            ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 379:
    if test -d $dir; then
               ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 381:
            activate python/$version
                            ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 383:
            log activate $version
                         ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 393:
    log install Python-$version
                       ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 395:
    is_ok $url || abort "invalid version $version"
          ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 397:
    log create $dir
               ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 398:
    mkdir -p $dir
             ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 402:
        touch $dir/p.lock
              ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 405:
    cd $dir
       ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 407:
    log fetch $url
              ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 409:
    curl -L# $url | tar -zx --strip 1
             ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 412:
    rm -f $dir/p.lock
          ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 414:
    log configure $version
                  ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 417:
    log compile $version
                ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 424:
    activate python/$version
                    ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 425:
    log activate $version
                 ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 442:
    test -z $1 && abort "version(s) required"
            ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 445:
        rm -rf $BASE_VERSIONS_DIR/python/${version#v}
               ^-- SC2086: Double quote to prevent globbing and word splitting.
                                         ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 446:
        log remove $version
                   ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 449:
    versions=$@
             ^-- SC2124: Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.

In p.sh line 461:
    if [ ! -z $1 ]; then
              ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 464:
        if [ ! -d $BASE_VERSIONS_DIR/python/$current ]; then
                  ^-- SC2086: Double quote to prevent globbing and word splitting.
                                            ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 472:
    if test -f $bin; then
               ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 473:
        printf "$bin \n"
               ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".

In p.sh line 484:
    test -z $1 && abort "version required"
            ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 490:
    if test -f $bin; then
               ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 502:
    latest_directory=$($GET 2> /dev/null ${MIRROR} \
                                         ^-- SC2128: Expanding an array without an index only gives the first element.
                                         ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 507:
    $GET 2> /dev/null ${MIRROR}$latest_directory \
                      ^-- SC2128: Expanding an array without an index only gives the first element.
                      ^-- SC2086: Double quote to prevent globbing and word splitting.
                               ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 531:
    $GET 2> /dev/null ${MIRROR} \
                      ^-- SC2128: Expanding an array without an index only gives the first element.
                      ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 557:
    versions=$($GET 2> /dev/null ${MIRROR} \
                                 ^-- SC2128: Expanding an array without an index only gives the first element.
                                 ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 568:
            printf "  \033[36mο\033[0m $v \033[0m\n"
                   ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".

In p.sh line 570:
            if test -d $BASE_VERSIONS_DIR/python/$v; then
                       ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                 ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 571:
                printf "    $v \033[0m\n"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".

In p.sh line 573:
                printf "    \033[90m$v\033[0m\n"
                       ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".

In p.sh line 595:
                latest) display_bin_path_for_version $($0 ls latest); exit ;;
                                                     ^-- SC2046: Quote this to prevent word splitting.

In p.sh line 596:
                stable) display_bin_path_for_version $($0 ls stable); exit ;;
                                                     ^-- SC2046: Quote this to prevent word splitting.

In p.sh line 597:
                *) display_bin_path_for_version $2; exit ;;
                                                ^-- SC2086: Double quote to prevent globbing and word splitting.

In p.sh line 600:
            as|use) shift; execute_with_version $@; exit ;;
                                                ^-- SC2068: Double quote array expansions, otherwise they're like $* and break on spaces.

In p.sh line 601:
            rm|-) shift; remove_versions $@; exit ;;
                                         ^-- SC2068: Double quote array expansions, otherwise they're like $* and break on spaces.

In p.sh line 611:
            latest) install $($0 ls latest); exit ;;
                            ^-- SC2046: Quote this to prevent word splitting.

In p.sh line 612:
            stable) install $($0 ls stable); exit ;;
                            ^-- SC2046: Quote this to prevent word splitting.

In p.sh line 613:
            *) install $1; exit ;;
                       ^-- SC2086: Double quote to prevent globbing and word splitting.

Wrong shell output

If p can't find bashrc or zshrc, it only says it couldn't find zshrc.

It'd probably be more helpful to say something like, "Can't guess what shell you're using".

Possible Name Change

Was toying with the idea of a name change in order to prevent any conflicts and make the purpose of the script easily understood from the name.

How does pvm (for Python Version Manager) sound?

python 3.5.1 shows as installed after "Error Unable to compile python 3.5.1! " and activation does not work.

Python 2.7.10 is installed on Ubuntu via apt.
downloaded p
p 3.5.1

 install : Python-3.5.1
  create : /usr/local/p/versions/python/3.5.1
   fetch : https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz

configure : 3.5.1
compile : 3.5.1

Error: Unable to compile Python 3.5.1!

but then:
p 3.5.1
activate : 3.5.1

Success: Now using Python 2.7.10!

2.7.10 shows greyed out,
3.5.1 shows light text indicating it is available.
python --version
Python 2.7.10

Error: no installed version

Hi,
Configuration : Manjaro Linux 32 bits (based on archlinux)
i wanted to try p
so, i learnt the readme what explains how to install it
i do :

  wget https://github.com/qw3rtman/p/releases/download/v0.1.0/p
  chmod +x p
  sudo mv p /usr/local/bin
  sudo p
  grep: /root/.zshrc: No files or folders of this type

  Error: no installed version

got 'Error: invalid version 3.5.0'

$ p ls
$ p stable
$ p latest

the terminal seems dead without respond for a long time

$ p
Error: no installed version

I did install p correctly,but it seems not work porperly

when I typed p 3.5.0,it showed it was intalling ,but I got the error I mentioned at the title.

Fish shell support.

Currently, p is not working in Fish shell - at least with full functionality. You can use p in Fish shell to install and then use 'p 2.7.10' to switch the version. However, the interactive selection and detection of config.fish (as opposed to zshrc or bashrc) is not implemented. I've forked to try and work on the issue, but would welcome help from those more experienced with Fish.

Error: Version required!

▶ p status
version : 2.7.11
bin :
Error: Version required!
previous : none

i've install pyton3.5
why it cant find ?

Error: Unable to compile Python

os: centos7.3

[root@centos ~]# p 2.7.13

     install : Python-2.7.13
      create : /usr/local/p/versions/python/2.7.13
       fetch : https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
   configure : 2.7.13
     compile : 2.7.13

  Error: Unable to compile Python 2.7.13!

[root@centos ~]# p 3.6.2

     install : Python-3.6.2
      create : /usr/local/p/versions/python/3.6.2
       fetch : https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz
   configure : 3.6.2
     compile : 3.6.2

  Error: Unable to compile Python 3.6.2!

K

O

p is looking for python.exe when it's not ready yet

Hello,

correct me if I'm wrong, but on this line:

p/p

Line 390 in 14d3c69

if [ ! -f "python.exe" ]; then
p is looking for a ".exe" file right after compilation.
As far as I can tell, the ".exe" symbolic link is done in the activate routine, here:

p/p

Line 293 in 14d3c69

ln -sf $BASE_VERSIONS_DIR/$version/python.exe $BASE_VERSIONS_DIR/python/python

due to the fact that the file is missing, I think that the program displays the "Unable to compile" message, despite the apparent success of the compilation.

just can't alter python version to 2.7.10

I use p to install 2.7.10 version but can't alter to it
the terminal info always be that
activate : 2.7.10

Success: Now using Python 2.7.11!

I use mac and the 2.7.11 is installed at /usr/local/Frameworks/Python.frameworks/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.