Skip to content
This repository has been archived by the owner on Feb 12, 2021. It is now read-only.

Add installation script #107

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

chetanya-shrimali
Copy link

run using source ./installation.sh
It will do following things:

  • Set up the virtual-env scancode-server
  • Activate it
  • Install the requirements

Signed-off-by: chetanya-shrimali [email protected]

@chetanya-shrimali
Copy link
Author

regarding #106
Plz review @singh1114 @pombredanne

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

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

Thanks!
This might better named install or configure. I would much prefer using the scancode-toolkit config style here too

installation.sh Outdated
@@ -0,0 +1,5 @@
#!/bin/bash
virtualenv -q -p /usr/bin/python3.5 scancode-server
Copy link
Member

Choose a reason for hiding this comment

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

We are not using Python 3 for this project, but only Python 2.7 for as long as ScanCode proper is nt ported to Python 3
Also, what are -q and -p options? long form are better
Also this is not portable on Windows, is it?
I would much prefer that we adopt the configure script from scancode https://github.com/nexB/scancode-toolkit/blob/f8132b344ba3a700907c41038e3d663002bbac63/configure ... Can you look into this?

Copy link
Author

@chetanya-shrimali chetanya-shrimali Dec 1, 2017

Choose a reason for hiding this comment

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

yaa, I'll see it and make required changes!!

Copy link
Author

Choose a reason for hiding this comment

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

sorry about -q and -p part, -q is for quiet and -p is an option to decide the python interpreter to create virtual env which requires python root directory as an argument.

Copy link
Member

Choose a reason for hiding this comment

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

Just use the long form in the script please.

Copy link
Author

Choose a reason for hiding this comment

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

Done that!!

installation.sh Outdated
virtualenv -q -p /usr/bin/python3.5 scancode-server
source scancode-server/bin/activate
pip install -r requirements.txt
echo "source scancode-server/bin/activate"
Copy link
Member

Choose a reason for hiding this comment

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

Why this echo? what does it bring?

Copy link
Author

Choose a reason for hiding this comment

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

that was a mistake. I'll remove it!! 😉

@chetanya-shrimali
Copy link
Author

scancode3
It can also be written as mentioned above.
Actually it is able to execute using git bash on windows but what it will do is install the requirements only. We i will have to add if-else condition and define methods for windows.
I can proceed to it if you are ok with it.
@pombredanne plz review!!

@pombredanne
Copy link
Member

The point is not it executes, but that it pass the tests on Python3. If you can install and pass the tests of https://github.com/nexB/scancode-toolkit on Python3 that would be news to me.

@chetanya-shrimali
Copy link
Author

@pombredanne That was the problem we discussed earlier regarding issue #100 in pr #105. And finalized that we have to consider that the user has already installed scancode-toolkit .
If we keep in mind that, then there is no further need install scancode-toolkit requirement and it will pass.
Plz correct me if i got your point the wrong way 😉

@pombredanne
Copy link
Member

scancode-toolkit DOES NOT RUN on Python3, therefore scancode-server that depends on scancode-toolkit CANNOT RUN on Python3, simple.

@chetanya-shrimali
Copy link
Author

@pombredanne Pardon, but i changed it to Python 2.7 😓

@pombredanne pombredanne changed the title added installation script Add installation script Dec 1, 2017
@chetanya-shrimali
Copy link
Author

@pombredanne plz review!

install.sh Outdated
@@ -0,0 +1,4 @@
#!/bin/bash
virtualenv --quiet --python=/usr/bin/python2.7 scancode-server
Copy link
Member

Choose a reason for hiding this comment

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

Where do you get virtualenv from?
Could you try to see how the scancode-toolkit configure script works and use this instead?

Copy link
Author

Choose a reason for hiding this comment

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

Okk!! @pombredanne i will see to how that works! but plz let me know the problem this code. Like it does what we want it to.

Copy link
Member

Choose a reason for hiding this comment

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

This script is fine. But I would rather have a proper ./configure, scancode-toolkit style

Copy link
Author

Choose a reason for hiding this comment

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

ok!! will work on that!

@chetanya-shrimali
Copy link
Author

chetanya-shrimali commented Jan 1, 2018

@pombredanne The error is at line 11 of etc/conf/dev/base.txt. Error message is no module named encodings. Which comes when running install.sh.

@pombredanne
Copy link
Member

Thanks. I think you have copied too much from scancode etc/ ..... take only what is strictly needed. Not everything.
Also how come there are 17K+ file changed? that does not sound right?

What is media/AnonymousUser ? Why did you commit bin, lib, include and all your local virtual env things? This should never be commited and part of the gitignore (see the gitignore in scancode-toolkit)

@pombredanne
Copy link
Member

Thanks!. what is the etc/configure2.py file in the commits?

@pombredanne
Copy link
Member

And what are the changes you made to the original script?

@chetanya-shrimali
Copy link
Author

This is not the final commit 😅

@chetanya-shrimali
Copy link
Author

@pombredanne plz review. I will document it after we reach on a common solution. Thanks!

@pombredanne
Copy link
Member

pombredanne commented Jan 25, 2018

Thanks!
Your commit message needs to match our style. It is missing a signed-off-by and the subject should use the imperative style eg

Add installation script #106

Signed-off-by: name <email>

configure.sh Outdated
python2.7 "$CONFIGURE_ROOT_DIR/etc/ConfigureScript.py"
if [ -f "$CONFIGURE_ROOT_DIR/.scancode-server/bin/activate" ]; then
source $CONFIGURE_ROOT_DIR/.scancode-server/bin/activate
fi

Choose a reason for hiding this comment

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

It would be great if you could insert a newline.

etc/configure.py Outdated


def create_venv():
venv_dir = os.path.join(req_path, ".scancode-server")

Choose a reason for hiding this comment

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

Can we be consistent with the quotations ? Either "(double quotes) everywhere or '(single quotes) everywhere ?

Copy link
Member

Choose a reason for hiding this comment

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

we use single quote everywhere unless this is a doc string (or if the string contains single quotes)

etc/configure.py Outdated
@@ -0,0 +1,29 @@
import subprocess
import os
import virtualenv

Choose a reason for hiding this comment

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

Maybe we could have alphabetically sorted imports and according to the python style guide ?

@chetanya-shrimali
Copy link
Author

chetanya-shrimali commented Jan 27, 2018

screenshot from 2018-01-27 16-58-32
@pombredanne i have added wincertstore in third-party dir than why does it show error?

@chetanya-shrimali
Copy link
Author

chetanya-shrimali commented Feb 12, 2018

@pombredanne Its been a while since the pr was opened. @singh1114 plz review.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants