Sixdsn / terra-terminal

Terra is a GTK+3.0 based terminal emulator with useful user interface, it also supports multiple terminals with splitting screen horizontally or vertically. New features have been added since September 2013. It's a pretty new and experimental project, if you want to contribute just checkout and try.
GNU General Public License v3.0
7 stars 3 forks source link

Allow to run terra from sources without installing it #77

Closed Sixdsn closed 9 years ago

Sixdsn commented 9 years ago

@SchnWalter proposed to allow to run terra directly from the sources without using the installation script. You can create a new branch based on develop and push your commits with the issue number in te commit message.

SchnWalter commented 9 years ago

So, installing terra the old way still works, you can now directly run the install command and it will also build the C binaries:

sudo ./setup.py install
or
sudo pip install .

And this will create the following files.

/usr/bin/terra
/usr/lib64/python2.7/site-packages/terra/...
/usr/share/applications/terra.desktop
/usr/share/icons/hicolor/scalable/apps/terra.svg

And you can use sudo pip uninstall terra to cleanup all those files.

Alternatively you can run:

pip install --user --editable .

and then run the application using ./main/terra. Or by using adding ~/.local/bin to the $PATH and running terra directly.

echo "export PATH=$PATH:$HOME/.local/bin" > ~/.bashrc

and with --editable, you can start changing any file, and the changes will be picked up immediately.

Having the application work both as installed files and in place, required the addition of an extra ROOT variable in main.py and one extra method to decide what paths to use for resources: TerraHandler.get_resources_path().

SchnWalter commented 9 years ago

Oh and I broke i18n even more, now the desktop file is not translated any more, I'll have to see how I can properly generate that file.

But we can fix it later as part of #63

Sixdsn commented 9 years ago

Hi,

I found something quite annoying in sudo ./setup.py install

Processing dependencies for terra==0.3.0
Searching for gi
Reading https://pypi.python.org/simple/gi/
Best match: gi 1.2
Downloading https://pypi.python.org/packages/source/g/gi/gi-1.2.tar.gz#md5=63bdf817281813f049064133ed584a6e
Processing gi-1.2.tar.gz
Writing /tmp/easy_install-6D54xK/gi-1.2/setup.cfg
Running gi-1.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-6D54xK/gi-1.2/egg-dist-tmp-zfIwKH
creating /usr/local/lib/python2.7/dist-packages/gi-1.2-py2.7.egg
Extracting gi-1.2-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding gi 1.2 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/gi-1.2-py2.7.egg
Searching for requests==2.4.3
Best match: requests 2.4.3
Adding requests 2.4.3 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Finished processing dependencies for terra==0.3.0

Which gives me:

six@six-laptop:~/github/terra-terminal$ terra
Traceback (most recent call last):
  File "/usr/local/bin/terra", line 9, in <module>
    load_entry_point('terra==0.3.0', 'console_scripts', 'terra')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 521, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2632, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2312, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2318, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/terra-0.3.0-py2.7-linux-x86_64.egg/terra/__main__.py", line 25, in <module>
    from terra.config import ConfigManager
  File "/usr/local/lib/python2.7/dist-packages/terra-0.3.0-py2.7-linux-x86_64.egg/terra/config.py", line 26, in <module>
    from gi.repository import Gdk
ImportError: No module named repository

This is why I wasn't able to check your pull request before as it broke something in the gi module on my work laptop and now on my personal one...

I will try to figure out what is going on there

UPDATE 1: actually it messed up with gi AND requests:

six@six-laptop:~/github/terra-terminal$ sudo pip install
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 521, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2632, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2312, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2318, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
    from pip.download import path_to_url
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 25, in <module>
    from requests.compat import IncompleteRead
ImportError: cannot import name IncompleteRead

as we can see here:

Processing dependencies for terra==0.3.0
Searching for gi==1.2
Best match: gi 1.2
Processing gi-1.2-py2.7.egg
gi 1.2 is already the active version in easy-install.pth

Using /usr/local/lib/python2.7/dist-packages/gi-1.2-py2.7.egg
Searching for requests==2.7.0
Best match: requests 2.7.0
Adding requests 2.7.0 to easy-install.pth file

Using /usr/local/lib/python2.7/dist-packages
Finished processing dependencies for terra==0.3.0

Thoses are the two modules that the setup.py script modifies

UPDATE 2: I fixed requests module issue with this tip: https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1306991/comments/8 But i still have the gi.repository issue even after trying to remove or reinstall the gi module

SchnWalter commented 9 years ago

To make gi work I had to install gtk3-devel (probably *-dev in debian systems).

I'll give it a try on a debian VM and see what happens.

Sixdsn commented 9 years ago

Well the thing is that it worked unitl now and now even when i use the develop branch i have this issue. I will try to look deeper tomorrow

Sixdsn commented 9 years ago

Okay i found it, in the setup.py you added this dependency:

    install_requires=[
        'gi',
    ],

which installs this gi package: https://pypi.python.org/pypi/gi/

I think it's a mistake and actually this package installs himself where the relevant gi we need is also installed. I cleaned everything, uninstalled gi from pip and reconfigured all my python-gi packages and now it's fine :)

SchnWalter commented 9 years ago

I eventually installed Debian8 inside an VM, made a snapshot while it was still new, and tried to install terra several times. Here is what I came up with:

I still have to check the exact requirements on openSUSE. but these should be part of the setup instructions for now, until we clean it up.

Sixdsn commented 9 years ago

I will finish to review your pull request today so we can merge it on develop and move on to the other issues. We also need to check the requirements on Fedora, i will install a few VM's to do integration an behaviour tests.