Re: Patches

From: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: Patches
Date: 2016-06-16 10:40:52
Message-ID: CANFyU943pY3N6sNL8F4Sv30rVABF3dPNtFVVcisG-afHSxzqUQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Thu, Jun 16, 2016 at 3:19 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> On Thu, Jun 16, 2016 at 8:51 AM, Sandeep Thakkar
> <sandeep(dot)thakkar(at)enterprisedb(dot)com> wrote:
> > Hi,
> >
> > I created virtual environment and tried building pgadmin on my Mac with
> > Python 3.3 and QT 5.5. I observed that in venv, the python3-config is
> copied
> > as python-config. Therefore, it's required to change pgAdmin4.pro to
> handle
> > this. With the existing .pro, it does not find the python3-config and
> > assumes it is Python2 and throws the following build error:
> > --
> > Server.cpp:36:5: error: no matching function for call to
> 'Py_SetProgramName'
> > Py_SetProgramName(PGA_APP_NAME.toUtf8().data());
> >
> >
> /mnt/hgfs/pginstaller.pune/server/source/pgadmin.osx/mac-build/venv/include/python3.3m/pythonrun.h:25:18:
> > note: candidate function not viable: no known conversion from 'char *' to
> > 'wchar_t *' for 1st
> >
> > argument
> >
> > PyAPI_FUNC(void) Py_SetProgramName(wchar_t *);
> > --
> >
> > I have attached the patch (pgadminpro.patch) to fix this.
>
> Configuration and build fails for me with this:
>
> yeah, the 'contains' function is trying to match the whole string.
Replacing that line in the patch with "contains( LIBS, -lpython2.* )"
should work fine.

> Project MESSAGE: Building for QT5+...
> Project MESSAGE: Configure pgAdmin4 to run in debug mode...
> Project MESSAGE: Building for Linux/Mac...
> /bin/sh: python3-config: command not found
> /bin/sh: python3-config: command not found
> /bin/sh: python3-config: command not found
> Project MESSAGE: Python3 detected.
>
> (pgadmin4)piranha:pgAdmin4 dpage$ which python-config
> /usr/bin/python-config
> (pgadmin4)piranha:pgAdmin4 dpage$ which python3-config
> (pgadmin4)piranha:pgAdmin4 dpage$ locate python3-config
> (pgadmin4)piranha:pgAdmin4 dpage$ python-config --libs
> -lpython2.7 -ldl -framework CoreFoundation
>
> Though - I also get some funky output without the patch (but, the
> build succeeds):
>
> Project MESSAGE: Building for QT5+...
> Project MESSAGE: Configure pgAdmin4 to run in debug mode...
> Project MESSAGE: Building for Linux/Mac...
> /bin/sh: python3-config: command not found
> /bin/sh: python3-config: command not found
> /bin/sh: python3-config: command not found
>
>
> > Another thing i observed is that in venv, the encodings directory in sym
> > linked to the actual one on the system and hence the build fails with the
> > following error:
> > --
> > Could not find platform independent libraries <prefix>
> > Could not find platform dependent libraries <exec_prefix>
> > Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
> > Fatal Python error: Py_Initialize: unable to load the file system codec
> > ImportError: No module named 'encodings'
> > --
> >
> > I have attached the patch (pgadmin-macbuild.patch) to make sure the
> > virtualenv for macbuild copies the required files instead of linking. In
> the
> > same patch, I also modified the build script to not rename the actual
> > directory of python in venv (as python libs may refer the actual
> directory)
> > and instead create a sym link. There might be other way to fix this, but
> I
> > found this to be easy. :)
>
> This second patch breaks builds for me:
>
> This is strange because I just added a new option "--always-copy" to
virtualenv. What is your path to virtualenv? Could you please try running
'virtualenv -v --always-copy -p
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2
/tmp/venv'

> PYTHON_HOME not set. Setting it to default
> QTDIR not set. Setting it to default
> PGDIR not set. Setting it to default
> Cleaning up the old environment and app bundle
> Running virtualenv with interpreter
> /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2
> Traceback (most recent call last):
> File "/Library/Python/2.7/site-packages/virtualenv.py", line 2311, in
> <module>
> main()
> File "/Library/Python/2.7/site-packages/virtualenv.py", line 703, in main
> symlink=options.symlink)
> File "/Library/Python/2.7/site-packages/virtualenv.py", line 916, in
> create_environment
> site_packages=site_packages, clear=clear, symlink=symlink))
> File "/Library/Python/2.7/site-packages/virtualenv.py", line 1111,
> in install_python
> copyfile(join(stdlib_dir, fn), join(lib_dir, fn), symlink)
> File "/Library/Python/2.7/site-packages/virtualenv.py", line 352, in
> copyfile
> copyfileordir(src, dest, symlink)
> File "/Library/Python/2.7/site-packages/virtualenv.py", line 324, in
> copyfileordir
> shutil.copytree(src, dest, symlink)
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py",
> line 208, in copytree
> raise Error, errors
> shutil.Error:
> [('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/config.c',
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/config.c',
> "[Errno 1] Operation not permitted:
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/config.c'"),
>
> ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/
> config.c.in',
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/config.c.in
> ',
> "[Errno 1] Operation not permitted:
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/config.c.in
> '"),
>
> ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/install-sh',
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/install-sh',
> "[Errno 1] Operation not permitted:
>
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/install-sh'"),
>
> ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.a',
>
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/libpython2.7.a',
> "[Errno 1] Operation not permitted:
>
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/libpython2.7.a'"),
>
> ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib',
>
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/libpython2.7.dylib',
> "[Errno 1] Operation not permitted:
>
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/libpython2.7.dylib'"),
>
> ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Makefile',
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/Makefile',
> "[Errno 1] Operation not permitted:
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/Makefile'"),
>
> ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/makesetup',
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/makesetup',
> "[Errno 1] Operation not permitted:
>
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/makesetup'"),
>
> ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/python.o',
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/python.o',
> "[Errno 1] Operation not permitted:
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/python.o'"),
>
> ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Setup',
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/Setup',
> "[Errno 1] Operation not permitted:
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/Setup'"),
>
> ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Setup.config',
>
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/Setup.config',
> "[Errno 1] Operation not permitted:
>
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/Setup.config'"),
>
> ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Setup.local',
>
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/Setup.local',
> "[Errno 1] Operation not permitted:
>
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config/Setup.local'"),
>
> ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config',
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config',
> "[Errno 1] Operation not permitted:
> '/Users/dpage/git/pgadmin4/mac-build/venv/lib/python2.7/config'")]
> make: *** [appbundle] Error 1
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

--
Sandeep Thakkar

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2016-06-16 10:42:54 Re: Fix for issue RM1336 [pgadmin4]
Previous Message Harshal Dhumal 2016-06-16 10:40:32 Re: Fix for issue RM1336 [pgadmin4]