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

Setup script #12

Closed
NotAFile opened this issue Sep 30, 2013 · 29 comments
Closed

Setup script #12

NotAFile opened this issue Sep 30, 2013 · 29 comments

Comments

@NotAFile
Copy link

Old title: Bring along all the needed modules (or at least a list)

This is just a personal thing, but it's kind of annoying to download something and having to pip install a bunch of non stock modules, especially If the packages don't have the name they are imported by.

@NotAFile
Copy link
Author

tools/setup.py

@gdude2002
Copy link
Member

The setup.py is old and needs updating. We're going to be writing a better one, because not everyone needs EG the Mumble protocol (which requires Google's protobuf), or SSL for IRC (Which requires PyOpenSSL).

We'll start working on that once the base app is working. If you feel like writing a start yourself, feel free to fork us and submit a pull request.

@NotAFile
Copy link
Author

I've been thinking of helping out a bit anyway, I could work on it. What are you thinking of? Gui, cli? both? I feel like I need a bit more info before I can start with it :P

@gdude2002
Copy link
Member

Well, the main target right now would be Linux servers, however rakiru and I both develop on Windows, so it's pretty cross-platform. I'd think that a CLI setup script would be more suitable in that case, though I realize that there'll always be people running this thing from their home PCs as well. So, I dunno, really, but whatever we have will need to have some kind of CLI.

@NotAFile
Copy link
Author

Ill get to work on it if Im sick of my other projects :) easy_install or pip? or something from within python?

@gdude2002
Copy link
Member

It'd have to be something from within Python, since people would be making choices on what modules they want to use, I think.

And, awesome. I look forward to seeing how you do.

@NotAFile NotAFile reopened this Sep 30, 2013
@gdude2002
Copy link
Member

Any progress on this, good sir?

@NotAFile
Copy link
Author

I rewrote the script entirely the other day, but I discussed with @rakiru, and he agreed that we would need a different approach. I talked about using pip, if available, or eggs. At the current state I don't know enough of your expectations for the script so I have stopped work on it

@rakiru
Copy link
Member

rakiru commented Oct 14, 2013

I didn't realise you'd actually rewritten it already. Yeah, in my opinion, it'd be preferable to use pip, but using something else wouldn't be a major issue.

Something else I'll mention here is that some packages require extra setup, like the OpenSSL one, which on Windows requires making sure openssl.exe is available.

@gdude2002
Copy link
Member

If you take a look at the requirements page on the wiki, you can see that pip is actually not included with Python for Windows, so it might not actually be such a good idea.

@NotAFile
Copy link
Author

a simple try: import pip should be good enough for pip. I would suppose catching errors is a secure way to check for openssl, but checking the folder could be better if the Exception does not send a proper error message

@gdude2002
Copy link
Member

Sure, we could catch that, but at the same time, it would still be nice to have an automated way to install pip on Windows. I quite wonder how setuptools manages that..

@rakiru
Copy link
Member

rakiru commented Oct 16, 2013

Annoyingly, writing something to install pip automatically would require a fresh install. I might try it later in a VM so I can revert to a clean snapshot every time.

@gdude2002
Copy link
Member

Well if this only applies to windows, we can grab the msi and run it..

EDIT: The msi of setuptools, that is. And then easy_install pip.

@NotAFile
Copy link
Author

yeah, that would work well

@gdude2002
Copy link
Member

Any progress on this, or are there questions that need answering?

@NotAFile
Copy link
Author

NotAFile commented Nov 6, 2013

No progress, I've been having a lot of stuff going on.

@gdude2002
Copy link
Member

That's okay.

I just realised we can use pip within code.. Since pip is installed by default on Linux/OSX and we recommend the installation of it for Windows, it seems reasonable to presume we can rely on that for the setup script, right? What do you think?

Info here: http://stackoverflow.com/questions/12332975/installing-python-module-within-code

@NotAFile
Copy link
Author

yeah, thats what rakiru and me came up with, for linux at least. Ironically, pip is a nuisance to install on windows though, and having a installer for the installer does seem a bit OTT. I have a bit of experience with packaging, but I'm not sure .msi does what would be appropriate for this situation. tl;dr: I have no clue how it should be user-friendly on windows

@gdude2002
Copy link
Member

Well, we recommended that people install pip via setuptools: https://github.com/McBlockitHelpbot/Ultros/wiki/Requirements

@rakiru
Copy link
Member

rakiru commented Nov 11, 2013

Edit: tl;dr, just add pip to the requirements.

In my opinion, everyone should have pip installed anyway. There's a bunch of other packages that need installed to use Ultros in the first place, so requiring the user to install pip so that we can simplify installing the rest, rather than requiring they install a bunch of other stuff manually.
Plus, most people running the bot on windows are likely people writing plugins/modules for it, and every python dev should have pip installed anyway.

@gdude2002
Copy link
Member

$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ [sudo] python get-pip.py

cough

@rakiru
Copy link
Member

rakiru commented Nov 11, 2013

pip uses itself to install itself.

I think we have a winner.

@rakiru rakiru closed this as completed Nov 11, 2013
@rakiru rakiru reopened this Nov 11, 2013
@rakiru
Copy link
Member

rakiru commented Nov 11, 2013

Hit the wrong button...

@NotAFile
Copy link
Author

If we really wanted to make it simple we could
try:
import pip
except ImportError:
subprocess.call(command above)

@gdude2002
Copy link
Member

No, we can't do a subprocess call because it needs to be cross-platform. However Python has functions to run the contents of a file, and we can just download it with urllib.urlretrieve or something.

@rakiru
Copy link
Member

rakiru commented Nov 22, 2013

Something I said in IRC at some point:
If the package manager gains the ability to ensure currently installed packages have their dependencies met, then all the setup script would have to do is ensure the base packages and installed (twisted and, eh, anything else...?).
Edit: And I suggest this added functionality for the package manager as it would greatly help when moving a bot between machines, such as moving to a new server.

@gdude2002
Copy link
Member

It already knows if stuff is installed already, man.

@gdude2002
Copy link
Member

Well the package manager is able to install pip now, so having it install the requirements.txt is definitely doable. I think this can probably be closed once that's done.

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

No branches or pull requests

3 participants