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

Add a simple chatbot for our IRC channel #62

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "include/redbot"]
path = include/redbot
url = https://github.com/mrhmouse/redbot.git
1 change: 1 addition & 0 deletions include/redbot
Submodule redbot added at 5e3bb4
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import py_compile
import sys
import stat
from subprocess import call

bin_dir = 'bin'
extbin_dir = 'extbin' # stands for 'external binaries'
Expand All @@ -41,7 +42,7 @@

executable_scripts = [ 'json-parse.py', 'xkcd-fetch.py', 'xkcd-search.py',
'level_up.py', 'summon.py', 'fortune.py', 'godel.py',
'random-number.py', 'rshelp.py', 'geico.py' ]
'random-number.py', 'rshelp.py', 'geico.py', 'redbot.coffee' ]

python_modules = 'src/xkcd-fetch.py src/level_up.py'.split()

Expand Down Expand Up @@ -158,8 +159,12 @@ def install ( ):
map(lambda x: splitext(x)[0], executable_scripts)
)
install_python_modules(python_modules)
install_submodules()
# add more of such steps if that's feasible and no build system is available

def install_submodules ( ):
call(["git", "submodule", "update"])
Copy link
Contributor

Choose a reason for hiding this comment

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

On Windows this will most likely throw a WindowsError, as git might not be in %path%.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, if git is installed it is in the PATH. Or at least if the user installed MsysGit, but probably also in case of the other ports (because git is supposed to be used from the command line). The real problem is that the user might not have git installed. But that can be dealt with by making the redbot install optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could also package some git Python module with RSP and use that instead. I don't have a preference; what do you suggest, @jgonggrijp?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure. What do you mean by "package some git Python module with RSP"?

Before knowing what you mean, I'm inclined to suggest that you just make the install optional. But once I know what you mean I might change my opinion. ;-)

Copy link

Choose a reason for hiding this comment

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

packaging a Python git module sounds silly. but correct me if i'm wrong, doesnt downloading the zip (the only way i can think of right now to download the project without using git) download the submodule as well? and same for downloading the project via git. doesnt it automatically download submodules too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps package the git module with creto? See #42.

Copy link
Member

Choose a reason for hiding this comment

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

No, downloading the repo (zip or git) does not automatically also download the submodule.

@WesleyAC: would packaging a git module (whatever that means) with git-creto not be completely backwards? Creto only makes sense if you're already using git.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By "packaging a git module" I mean including something like GitPython in the project so that we can interact with the Git repository.

Copy link
Member

Choose a reason for hiding this comment

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

GitPython looks useful. But it also seems that including it with the project would just move the problem, since it depends on GitDB. Ultimately, I think we always end up having the choice between declaring something an external dependency (and potentially making the installation of some apps dependent on it) and bloating our project with tons of included dependencies.


def install_rsshell ( ):
if not exists(src_dir):
print(no_src_panic_msg)
Expand Down
5 changes: 5 additions & 0 deletions src/redbot.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env coffee

path = require 'path'
Bot = require 'redbot'
ruddy = new Bot 'ruddy', '#redspider'
3 changes: 3 additions & 0 deletions src/rsshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ def get_red_spider_root():
def set_environment (rs_root):
bin_dir = join(rs_root, 'bin')
lib_dir = join(rs_root, 'lib')
include_dir = join(rs_root, 'include')
env_prepend('PATH', bin_dir)
env_prepend('PYTHONPATH', lib_dir)
env_prepend('NODE_PATH', include_dir)
if os.name == 'nt': # Windows
env_append('PATHEXT', '.py')
env_append('PATHEXT', '.coffee')
os.putenv('RED_SPIDER_ROOT', rs_root)

def env_prepend (varname, addition):
Expand Down