Category: Programming

Geany handbook

Programming

From one year now I’m a happy Emacs user and everyday i discover new extensions that make my life better. But Emacs is, for new users, really scary and have a steep learning curve if you want to be productive with it.

If you don’t have time or you simply dislike Emacs, I would suggest you to have a look at Geany. I’ve talked about it in previous posts for setting a dark theme. If you want to dig into Geany and be productive I really suggest to have a look at the book released by Packt called instant geany. It’s a powerful handbook that in less than a day will introduce to the core functionalities of Geany and will make, hopefully, productive in a short amount of time.

In 4 fast and easy chapters the book will explain how to install and use geany, use its very good source code navigation and go to function definitions that makes geany one of the best opensource IDE.

Svn in the git era without driving insane

hacksProgramming

If you, like me, are used to the beauty of git and create a branch for any single feature you would like to add to the master branch you are upset if you end up in a company that only uses svn as revision control system and they are not willing to make a switch anytime soon.

Some people, even dev managers, sometimes can’t understand how much more productive a good tool make employees. If you are used to merge the code or rebase with git you will find the merging tools of svn kinda obsolete. The fact that if somebody is doing a merge nobody else can commit to svn or everything may break is simply an insane idea for me.

If you are stuck in this kind of environment, you have a savior: it’s called git svn. I’ve been using it from more than one year now and I feel it great. The main concept is simple: git svn imports svn repositories into git ones. After this you can use them as normal git repositories. You can, for example, commit, rebase, rebase interactively, merge and then commit back to svn in the right branch. Git will figure out which is the right branch, but you can change it of course. To start with git svn just clone a svn repository with:


git svn clone -s svn://my_cool_server.com/my_cool_project

The -s will tell git to expect a standard format of svn, the one with a directory for trunk, branches and tags. If you are so unlucky to work with a not standard repo, you can use the -T -t and -b to specify the layout for trunktags and branches. This command will start fetching from revision #1 and will apply all the subsequent revisions. If you have a big repository (i’ve one with 50000 commits) you clearly don’t want to do that unless you don’t want your pc to spend days in fetching all reviews. You can tell git to only fetch the latest N revisions with :


git svn clone -s -rN:HEAD svn://my_cool_server/my_cool_project/

where N is a number.

After cloning, your new repo you can access your svn branches over remotes/BRANCH. This means that you can easily create a local branch that will track a svn branch with:


git checkout -t remotes/BRANCH

You can now do all commits, merges, rebase, interactive rebase you want, and even look at the svn patches and log with git log.

And finally, when you want to commit on the remoted tracked branch you simply do:


git svn dcommit

Sweet, isn’t it ?

Python Bunch object or How to make dictionaries act like objects

Programming

Python dictionaries are really powerful, but sometimes you need an object that is a dictionary but it’s also an object which keys are methods of the same object.
Now think if you can have a class called Bunch that makes something like this possible:

bunch = Bunch(a = 7, b = 3, c = 'hello')
In [5]: bunch.a
Out[5]: 7
In [6]: bunch.b
Out[6]: 3
In [7]: bunch.c
Out[7]: 'hello'

But it’s also more powerful than this:

In [9]: d = {'a.b.c':1, 'a.c':2}
In [10]: bunch = Bunch(**d)
In [11]: bunch.a
bunch.a      bunch.a.b.c  bunch.a.c
In [13]: print bunch.a.b.c
1
In [14]: print bunch.a.c
2
In [15]: print bunch['a.b.c']
1

You can also use the dot notation to describe an hierarchy of objects and the Bunch object will take care of it

It’s not a dream, I’ve just implemented this python Bunch Object and this is the code:

class C(object): pass

def rec_getattr(obj, attr):
    """
    Get object's attribute. May use dot notation.
    """
    if '.' not in attr:
        return getattr(obj, attr)
    else:
        L = attr.split('.')
        return rec_getattr(getattr(obj, L[0]), '.'.join(L[1:]))

def rec_setattr(obj, attr, value):
    """
    Set object's attribute. May use dot notation.
    """
    if '.' not in attr:
        setattr(obj, attr, value)
    else:
        L = attr.split('.')
        if not hasattr(obj, L[0]):
            setattr(obj, L[0], C())
        rec_setattr(getattr(obj, L[0]), '.'.join(L[1:]), value)

class Bunch(dict):
    def __init__(self,**kw):
        dict.__init__(self,kw)
        self.__dict__.update(kw)
        for k,v in kw.iteritems():
            rec_setattr(self, k, v) 

Comments, suggestions, patches are welcome 🙂

download list of files from a remote ssh/sftp server

Programming

I’ve approached this problem before. I’m on a server and I want to copy some directories from another server using scp. You have to write down all the paths of the directory you want of the first server, then go to the second, then do a command like:

scp -r server1:"directory1 directory2 directory3 ..." .

Which is easy with simple filenames but as soon as you need directories in different paths or long named directories it will be pain. And you don’t have shell completion. You could say: “Set up key authentication and you will have shell completion on the remote server”. Well, I don’t wanna set up keys for a server and I want a more practical way to solve this.
I wanted to connect through ssh from nautilus (just type ssh://server on the path bar), surf my remote directories, then download what i need to a second server. Well I did a python program to do that.
It’s pretty straightforward. You connect with nautilus to a server, select all the directories you want then copy them. Open the shell of another server, then do: python3 download.py -s server1 CTRL+V
The CTRL+V will copy all the filename absolute paths straight to the shell. Just hit enter, it will ask for password, just give it and you are done. It will start downloading all the list of directories of files you want from server1
This is the python program that makes this possible.

<pre>
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
This programs allows easy copies of remote directories to the local path using scp

        usage:
                python3 download.py [options] list-of-files

        options:
                -s, --server server:set the server instead of deducing it

@author: Vincenzo Ampolo <vincenzo.ampolo@gmail.com>
'''

import sys
import os
import getopt

import urllib.parse

def shellquote(s):
        """escapes the given string s such that it can be used safely in a shell
        """
        return "'" + s.replace("'", "'\''") + "'"

def main(argv=None):
        if argv is None:
           argv = sys.argv

        opts, extraparams = getopt.gnu_getopt(argv[1:], "hvs:", ["help", "server"])

        verbose = False
        server = None

        for o, a in opts:
                if o == "-v":
                        verbose = True
                elif o in ("-h", "--help"):
                        print(__doc__)
                        sys.exit(0)
                elif o in ("-s", '--server'):
                        server = a
                else:
                        assert False, "UnhandledOption"

        l = []
        for path in extraparams:
                url = urllib.parse.urlparse(path)
                if not server:
                        server = url.host
                quoted_path = shellquote(urllib.parse.unquote(url.path))
                l.append(quoted_path)
        files_to_download = ' '.join(l)
        cmd = 'scp -r %s:"%s" .'%(server, files_to_download)
        os.system(cmd)
        return 0

if __name__ == '__main__':
    sys.exit(main())
</pre>

How to set black background on geany and remove the green / white line

Programming

Geany is a very good editor to edit a big variety of source codes. Unfortunately it has a white background by default. I dunno if you have ever used a black background based editor such as vim but it makes your eyes less stressed when u are coding, and this thing is something that will increase your productivity. I tried to switch geany to use a black brackground and i found many extensions to do that… but i always have thought that it was impossible that geany codes didn’t think about this. After playing a bit with the settings i found a way.

Just go to Edit->Prerefencies then go to Editor and select the Display tab. U will see something like this:

 

Just select invert syntax highlight colors and you did it. If you want also to remove the odd green or white lines that appears after 72 characters you can just disable the long line marker and it will go 😉

Hope this helps

how to solve pymongo.errors.AutoReconnect: could not find master/primary

HowToProgramming

If you are coding and you have experienced an error like:

pymongo.errors.AutoReconnect: could not find master/primary

The problem is that your mongodb instance has not been shutdown correctly last time. To solve this just run the following command (it has been tested on a Ubuntu server):

sudo rm /var/lib/mongodb/mongod.lock && sudo /etc/init.d/mongodb restart

Hope this helps. I had to type that a lot of time during my coding time indeed.

How to pass environment variables to uwsgi from cherokee

Programming

Today i’ve faced an issue with cherokee + uwsgi. I had to deploy a webapp which needed the LD_LIBRARY_PATH set. After fighting a while with cherokee i found a way to accomplish it.
From cherokee just invoke uwsgi interpreter as follow:

/bin/bash -c "LD_LIBRARY_PATH=/usr/local/MATLAB/R2011a/bin/glnxa64 /usr/local/bin/uwsgi --ini-paste /var/www/whisperer/development.ini"

The trick is to start a bash, set the variable(s) u want in your webapp and then start uwsgi. handy, isn’t it ?

Hope this helps somehow…

How to integrate mongoengine in pyramid

Programming

For a project in the university i had to build a webapp, since it was a edu-based project and i wanted to try something which diverges from the classic Apache+django+mysql approach and i built a Cherokee+pyramid+mongodb applciation. In this article ill explain how to use mongoengine, a state-of-the-art django like ORM for mongodb in your pyramid application.

First of all i think that pyramid has the best and liter interface i’ve ever seen. This will let u integrate mongodb with very small work. If u ever used mongoengine, u just need to call:


from mongoengine import connect

connect('database')

So we need to call it in our application. In pyramid all the application is initialized in the __init__.py file which has this content:

from pyramid.config import Configurator
from myproject.resources import Root

def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(root_factory=Root, settings=settings)
    config.add_view('myproject.views.my_view',
                    context='myproject.resources.Root',
                    renderer='myproject:templates/mytemplate.pt')
    config.add_static_view('static', 'myproject:static')
    return config.make_wsgi_app()

You have to change it to be like:

from pyramid.config import Configurator
from myproject.resources import Root

def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(root_factory=Root, settings=settings)
    config.add_view('myproject.views.my_view',
                    context='myproject.resources.Root',
                    renderer='myproject:templates/mytemplate.pt')
    config.add_static_view('static', 'myproject:static')
    #this will make mongoengine working
    connect(settings['db_name'])
    #this will make all the @view_config in the view working
    config.scan()
    return config.make_wsgi_app()

Of course u have to define your db_name in production.ini or development.ini or both in a way which looks like this:

[app:milo_app]
use = egg:milo_app
reload_templates = true
debug_authorization = false
debug_notfound = false
debug_routematch = false
debug_templates = true
default_locale_name = en
db_name = milo

That’s it, u can now use mongoengine in the resources.py and in any other file u want to create like this:

from mongoengine import *
class User(Document):
	email = StringField(required=True)
	first_name = StringField()
	last_name = StringField()
	password = StringField()
	cwid = IntField()

class Comment(EmbeddedDocument):
	autor = ReferenceField(User)
	content = StringField()

class Genre(EmbeddedDocument):
	name = StringField()

class Movie(Document):
	__name__ = 'Movie'
	__parent__ = Root

	#movie is identified by title and year
	title = StringField(required=True)
	date = DateTimeField()
	description = StringField()
	trailer = URLField()
	poster = StringField()
	image = StringField()
	genre = ListField(StringField())
	comments = ListField(EmbeddedDocumentField(Comment))

	def __str__(self):
		return 'Movie(%s, %s, %s, %s, %s)' % (self.title, self.date, self.poster, self.image, self.trailer)

then in any view u can do:

Movie.objects()
User.objects()

To retrieve all the movies and all the users (in my case)
I hope this helps!

How to install psycopg2 under virtualenv

Programmingubuntu

If you have tried to install psycopg2 (Postgresql support for python) which is used by the popular sqlalchemy framework under virtualenv you will end up with something like this

(python-keygrabber-env)goshawk@cacserver:~/python-keygrabber-env/aranciulla/keygrabber$ pip install psycopg2
Downloading/unpacking psycopg2
  Running setup.py egg_info for package psycopg2
    
    Error: pg_config executable not found.
    
    Please add the directory containing pg_config to the PATH
    or specify the full executable path with the option:
    
        python setup.py build_ext --pg-config /path/to/pg_config build ...
    
    or with the pg_config option in 'setup.cfg'.
    Complete output from command python setup.py egg_info:
    running egg_info

writing pip-egg-info/psycopg2.egg-info/PKG-INFO

writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt

writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt

warning: manifest_maker: standard file '-c' not found



Error: pg_config executable not found.



Please add the directory containing pg_config to the PATH

or specify the full executable path with the option:



    python setup.py build_ext --pg-config /path/to/pg_config build ...



or with the pg_config option in 'setup.cfg'.

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/goshawk/.pip/pip.log
(python-keygrabber-env)goshawk@cacserver:~/python-keygrabber-env/aranciulla/keygrabber$ 

Don’t worry! you need to just install two packages on your ubuntu machine: libpq-dev python-dev. To do so just type in a terminal:

sudo apt-get install libpq-dev python-dev

and thus

(python-keygrabber-env)goshawk@cacserver:~/python-keygrabber-env/aranciulla/keygrabber$ pip install psycopg2
Downloading/unpacking psycopg2
  Running setup.py egg_info for package psycopg2
    
    no previously-included directories found matching 'doc/src/_build'
    warning: no files found matching 'NEWS-2.0'
    warning: no files found matching 'NEWS-2.3'
Installing collected packages: psycopg2
  Running setup.py install for psycopg2
    building 'psycopg2._psycopg' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/green.c -o build/temp.linux-x86_64-2.7/psycopg/green.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/pqpath.c -o build/temp.linux-x86_64-2.7/psycopg/pqpath.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/utils.c -o build/temp.linux-x86_64-2.7/psycopg/utils.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/bytes_format.c -o build/temp.linux-x86_64-2.7/psycopg/bytes_format.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/connection_int.c -o build/temp.linux-x86_64-2.7/psycopg/connection_int.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/connection_type.c -o build/temp.linux-x86_64-2.7/psycopg/connection_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/cursor_int.c -o build/temp.linux-x86_64-2.7/psycopg/cursor_int.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/cursor_type.c -o build/temp.linux-x86_64-2.7/psycopg/cursor_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/lobject_int.c -o build/temp.linux-x86_64-2.7/psycopg/lobject_int.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/lobject_type.c -o build/temp.linux-x86_64-2.7/psycopg/lobject_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/notify_type.c -o build/temp.linux-x86_64-2.7/psycopg/notify_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/xid_type.c -o build/temp.linux-x86_64-2.7/psycopg/xid_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_asis.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_binary.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_binary.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_datetime.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_datetime.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_list.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_list.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_pboolean.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_pboolean.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_pdecimal.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_pdecimal.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_pfloat.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_pfloat.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/adapter_qstring.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_qstring.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/microprotocols.c -o build/temp.linux-x86_64-2.7/psycopg/microprotocols.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/microprotocols_proto.c -o build/temp.linux-x86_64-2.7/psycopg/microprotocols_proto.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4-beta2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080407 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/typecast.c -o build/temp.linux-x86_64-2.7/psycopg/typecast.o -Wdeclaration-after-statement
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o build/temp.linux-x86_64-2.7/psycopg/green.o build/temp.linux-x86_64-2.7/psycopg/pqpath.o build/temp.linux-x86_64-2.7/psycopg/utils.o build/temp.linux-x86_64-2.7/psycopg/bytes_format.o build/temp.linux-x86_64-2.7/psycopg/connection_int.o build/temp.linux-x86_64-2.7/psycopg/connection_type.o build/temp.linux-x86_64-2.7/psycopg/cursor_int.o build/temp.linux-x86_64-2.7/psycopg/cursor_type.o build/temp.linux-x86_64-2.7/psycopg/lobject_int.o build/temp.linux-x86_64-2.7/psycopg/lobject_type.o build/temp.linux-x86_64-2.7/psycopg/notify_type.o build/temp.linux-x86_64-2.7/psycopg/xid_type.o build/temp.linux-x86_64-2.7/psycopg/adapter_asis.o build/temp.linux-x86_64-2.7/psycopg/adapter_binary.o build/temp.linux-x86_64-2.7/psycopg/adapter_datetime.o build/temp.linux-x86_64-2.7/psycopg/adapter_list.o build/temp.linux-x86_64-2.7/psycopg/adapter_pboolean.o build/temp.linux-x86_64-2.7/psycopg/adapter_pdecimal.o build/temp.linux-x86_64-2.7/psycopg/adapter_pfloat.o build/temp.linux-x86_64-2.7/psycopg/adapter_qstring.o build/temp.linux-x86_64-2.7/psycopg/microprotocols.o build/temp.linux-x86_64-2.7/psycopg/microprotocols_proto.o build/temp.linux-x86_64-2.7/psycopg/typecast.o -lpq -o build/lib.linux-x86_64-2.7/psycopg2/_psycopg.so
    
    no previously-included directories found matching 'doc/src/_build'
    warning: no files found matching 'NEWS-2.0'
    warning: no files found matching 'NEWS-2.3'
Successfully installed psycopg2
Cleaning up...
(python-keygrabber-env)goshawk@cacserver:~/python-keygrabber-env/aranciulla/keygrabber$ 

That’s all! 😀 Hope it was useful

%d bloggers like this: