Thread: [pgadmin][patch] Electron version 4.X

[pgadmin][patch] Electron version 4.X

From
Joao De Almeida Pereira
Date:

Hi Hackers,

Attached you can find the patch that introduces electron to our code base.

What do we provide with this patch:

  • Start the pgAdmin server from Electron
  • When starting pgAdmin, the user is shown a window that tells them that pgAdmin is loading.
  • Once the server has started, the loading window disappears and opens pgAdmin in a window
  • Desktop user has the ability to open up new windows to work in.
  • When you close pgAdmin it properly shuts everything down.
  • Stop using copy of web folder for development
    `
    This is the initial patch for people to start paying around with the electron version. There might be things that are not working.
    What we know:
  • Logging is not working on windows
  • We are not packaging any pg_* executables
  • Consistent/Centralized versioning between Electron and pgAdmin Server

We generated builds for:

We added some instructions on how to build these 3 binaries in electron/Readme.md

Thanks
Joao

Attachment

Re: [pgadmin][patch] Electron version 4.X

From
Dave Page
Date:
Hi

On Mon, Jun 4, 2018 at 10:27 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:

Hi Hackers,

Attached you can find the patch that introduces electron to our code base.

Cool. FYI, I'd like to get this into rough shape and then push it to a dev branch for fine-tuning. I think it'll be easier to work that way.
 

What do we provide with this patch:

  • Start the pgAdmin server from Electron
  • When starting pgAdmin, the user is shown a window that tells them that pgAdmin is loading.
  • Once the server has started, the loading window disappears and opens pgAdmin in a window
  • Desktop user has the ability to open up new windows to work in.
  • When you close pgAdmin it properly shuts everything down.
  • Stop using copy of web folder for development
I'm not sure what you mean by that last point?
 
  • `
    This is the initial patch for people to start paying around with the electron version. There might be things that are not working.
    What we know:
  • Logging is not working on windows
  • We are not packaging any pg_* executables
  • Consistent/Centralized versioning between Electron and pgAdmin Server
OK. 

    We generated builds for:

    We added some instructions on how to build these 3 binaries in electron/Readme.md

    Great. So here's my initial feedback:

    - The Mac build you provided doesn't work for me. It hangs on the loading screen.

    - A number of the changes are related to the naming of requirejs. I'd be inclined to pull that out into a separate patch and get it committed to master ASAP.

    - I think the build instructions need to be more generic (particularly on macOS). For example, I do not use HomeBrew (largely due to some nasty security issues they had in the past). I was able to mostly port the instructions and build script over to work using MacPorts (without PyEnv) which actually turned out to be somewhat more simple than what's there now.

    - I'm not sure what this is intended to do: "git checkout electron". Clearly that isn't correct.

    - All new builds should be using Python 3.6. We need to deprecate 2.7 as there are some Unicode related issues that cannot be fixed in it.

    - The Linux build isn't a Linux build in the general sense - it's a Debian build and should be named as such (and if we're including that, we should have a Redhat version - though that needn't hold up the current work). Sidenote: I'm not sure that either the APT or YUM PostgreSQL projects will accept a package built in this way as they're somewhat picky about following platform packaging rules which would mean using the system-installed Python. I think this is a sane way to go myself, but that's just my view.

    - I would like to see the new build code adapted to follow the existing conventions as much as reasonable, to avoid having to change build systems or other processes/procedures that folks use. For example, build scripts should be under pkg/, completed packages left in dist/, build staging done in xxx-build directories rather than elsewhere.

    - It may be a result of my use of MacPorts, but I'm getting the following failure building:

    yarn run v1.3.2
    $ electron-forge make --platfrom=darwin --arch=x64 --targets=dmg
    ✔ Checking your system
    ✔ Resolving Forge Config
    We need to package your application before we can make it
    ✔ Preparing to Package Application for arch: x64
    ⠼ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml
    Compiling /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml resulted in a MIME type of application/xml, which we don't know how to handle
    ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js
    /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js: Unexpected token (6:7)
    ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js
    /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js: Unexpected token (5:6)
    Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js
    /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js: Unexpected token (37:1)
    Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js
    /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js: Unexpected token (28:23)
    ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js
    /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js: Unexpected token, expected ; (2:29)
    ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alert.scss
    Error: Undefined variable: "$color-green-3".
            on line 29 of /stdin
    >>   background: $color-green-3;

       --------------^

    ⠙ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alertify.overrides.scss
    Error: ".ajs-message.ajs-error.ajs-visible" failed to @extend ".bg-red-1".
           The selector ".bg-red-1" was not found.
           Use "@extend .bg-red-1 !optional" if the extend should be able to fail.
            on line 164 of /stdin
    >>   @extend .bg-red-1;

       ----------^

    ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/sqleditor/_history.scss
    Error: Undefined variable: "$color-gray-3".
            on line 4 of /stdin
    >>     border-bottom: 1px solid $color-gray-3;

       -----------------------------^

    ⠇ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html
    /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html:inline_1.js: Unexpected token (2:13)
    ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js
    /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js: Unexpected token (2:10)
    ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js
    /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js: Unexpected token (3:15)
    ✔ Compiling Application
    ✔ Preparing native dependencies
    ✔ Packaging Application
    Making for the following targets:
    ⠋ Making for target: dmg - On platform: darwin - For arch: x64
    An unhandled exception has occurred inside Forge:
    Cannot find module 'macos-alias'
    Error: Cannot find module 'macos-alias'
        at Function.Module._resolveFilename (module.js:547:15)
        at Function.Module._load (module.js:474:25)
        at Module.require (module.js:596:17)
        at require (internal/module.js:11:18)
        at Object.<anonymous> (/private/var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/tmp.cTDTnGt3/electron/node_modules/ds-store/index.js:2:13)
        at Module._compile (module.js:652:30)
        at Object.Module._extensions..js (module.js:663:10)
        at Module.load (module.js:565:32)
        at tryModuleLoad (module.js:505:12)
        at Function.Module._load (module.js:497:3)
        at Module.require (module.js:596:17)
        at require (internal/module.js:11:18)
        at Object.<anonymous> (/private/var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/tmp.cTDTnGt3/electron/node_modules/appdmg/lib/appdmg.js:5:15)
        at Module._compile (module.js:652:30)
        at Object.Module._extensions..js (module.js:663:10)
        at Module.load (module.js:565:32)
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


    Thanks for working on this!

    --
    Dave Page
    Blog: http://pgsnake.blogspot.com
    Twitter: @pgsnake

    EnterpriseDB UK: http://www.enterprisedb.com
    The Enterprise PostgreSQL Company

    Re: [pgadmin][patch] Electron version 4.X

    From
    Murtuza Zabuawala
    Date:
    Hi Joao,

    Awesome job, I tried windows build & it is running very smooth on my Win10 VM, 

    It took some time when I ran it for the first time (I think because it ran "update.exe") but it was quick when opened second time onwards (taking ~6-7 secs to display the main window).

    The main thing I noticed is that it's not resource-hungry like other electron apps I have used earlier,
    - Resouce consumption with Dashboard
    CPU: ~20%
    RAM: ~300mb

    - Resouce consumption without Dashboard
    CPU: ~5%
    RAM: ~300mb

    Which is much lighter than I expected :)

    I'll also try it on my physical machine running Win7 and update the thread if I find any issue.


    On Tue, Jun 5, 2018 at 9:57 PM, Dave Page <dpage@pgadmin.org> wrote:
    Hi

    On Mon, Jun 4, 2018 at 10:27 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:

    Hi Hackers,

    Attached you can find the patch that introduces electron to our code base.

    Cool. FYI, I'd like to get this into rough shape and then push it to a dev branch for fine-tuning. I think it'll be easier to work that way.
     

    What do we provide with this patch:

    • Start the pgAdmin server from Electron
    • When starting pgAdmin, the user is shown a window that tells them that pgAdmin is loading.
    • Once the server has started, the loading window disappears and opens pgAdmin in a window
    • Desktop user has the ability to open up new windows to work in.
    • When you close pgAdmin it properly shuts everything down.
    • Stop using copy of web folder for development
    I'm not sure what you mean by that last point?
     
    • `
      This is the initial patch for people to start paying around with the electron version. There might be things that are not working.
      What we know:
    • Logging is not working on windows
    • We are not packaging any pg_* executables
    • Consistent/Centralized versioning between Electron and pgAdmin Server
    OK. 

      We generated builds for:

      We added some instructions on how to build these 3 binaries in electron/Readme.md

      Great. So here's my initial feedback:

      - The Mac build you provided doesn't work for me. It hangs on the loading screen.

      - A number of the changes are related to the naming of requirejs. I'd be inclined to pull that out into a separate patch and get it committed to master ASAP.

      - I think the build instructions need to be more generic (particularly on macOS). For example, I do not use HomeBrew (largely due to some nasty security issues they had in the past). I was able to mostly port the instructions and build script over to work using MacPorts (without PyEnv) which actually turned out to be somewhat more simple than what's there now.

      - I'm not sure what this is intended to do: "git checkout electron". Clearly that isn't correct.

      - All new builds should be using Python 3.6. We need to deprecate 2.7 as there are some Unicode related issues that cannot be fixed in it.

      ​+1

      - The Linux build isn't a Linux build in the general sense - it's a Debian build and should be named as such (and if we're including that, we should have a Redhat version - though that needn't hold up the current work). Sidenote: I'm not sure that either the APT or YUM PostgreSQL projects will accept a package built in this way as they're somewhat picky about following platform packaging rules which would mean using the system-installed Python. I think this is a sane way to go myself, but that's just my view.

      - I would like to see the new build code adapted to follow the existing conventions as much as reasonable, to avoid having to change build systems or other processes/procedures that folks use. For example, build scripts should be under pkg/, completed packages left in dist/, build staging done in xxx-build directories rather than elsewhere.

      - It may be a result of my use of MacPorts, but I'm getting the following failure building:

      yarn run v1.3.2
      $ electron-forge make --platfrom=darwin --arch=x64 --targets=dmg
      ✔ Checking your system
      ✔ Resolving Forge Config
      We need to package your application before we can make it
      ✔ Preparing to Package Application for arch: x64
      ⠼ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml
      Compiling /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml resulted in a MIME type of application/xml, which we don't know how to handle
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js: Unexpected token (6:7)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js: Unexpected token (5:6)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js: Unexpected token (37:1)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js: Unexpected token (28:23)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js: Unexpected token, expected ; (2:29)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alert.scss
      Error: Undefined variable: "$color-green-3".
              on line 29 of /stdin
      >>   background: $color-green-3;

         --------------^

      ⠙ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alertify.overrides.scss
      Error: ".ajs-message.ajs-error.ajs-visible" failed to @extend ".bg-red-1".
             The selector ".bg-red-1" was not found.
             Use "@extend .bg-red-1 !optional" if the extend should be able to fail.
              on line 164 of /stdin
      >>   @extend .bg-red-1;

         ----------^

      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/sqleditor/_history.scss
      Error: Undefined variable: "$color-gray-3".
              on line 4 of /stdin
      >>     border-bottom: 1px solid $color-gray-3;

         -----------------------------^

      ⠇ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html:inline_1.js: Unexpected token (2:13)
      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js: Unexpected token (2:10)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js: Unexpected token (3:15)
      ✔ Compiling Application
      ✔ Preparing native dependencies
      ✔ Packaging Application
      Making for the following targets:
      ⠋ Making for target: dmg - On platform: darwin - For arch: x64
      An unhandled exception has occurred inside Forge:
      Cannot find module 'macos-alias'
      Error: Cannot find module 'macos-alias'
          at Function.Module._resolveFilename (module.js:547:15)
          at Function.Module._load (module.js:474:25)
          at Module.require (module.js:596:17)
          at require (internal/module.js:11:18)
          at Object.<anonymous> (/private/var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/tmp.cTDTnGt3/electron/node_modules/ds-store/index.js:2:13)
          at Module._compile (module.js:652:30)
          at Object.Module._extensions..js (module.js:663:10)
          at Module.load (module.js:565:32)
          at tryModuleLoad (module.js:505:12)
          at Function.Module._load (module.js:497:3)
          at Module.require (module.js:596:17)
          at require (internal/module.js:11:18)
          at Object.<anonymous> (/private/var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/tmp.cTDTnGt3/electron/node_modules/appdmg/lib/appdmg.js:5:15)
          at Module._compile (module.js:652:30)
          at Object.Module._extensions..js (module.js:663:10)
          at Module.load (module.js:565:32)
      error Command failed with exit code 1.
      info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


      Thanks for working on this!

      --
      Dave Page
      Blog: http://pgsnake.blogspot.com
      Twitter: @pgsnake

      EnterpriseDB UK: http://www.enterprisedb.com
      The Enterprise PostgreSQL Company

      Regards,
      Murtuza

      Re: [pgadmin][patch] Electron version 4.X

      From
      Victoria Henry
      Date:


      On Tue, Jun 5, 2018 at 12:28 PM Dave Page <dpage@pgadmin.org> wrote:
      Hi

      On Mon, Jun 4, 2018 at 10:27 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:

      Hi Hackers,

      Attached you can find the patch that introduces electron to our code base.

      Cool. FYI, I'd like to get this into rough shape and then push it to a dev branch for fine-tuning. I think it'll be easier to work that way.
      Sure, you can create a dev branch and push this patch to it.

      Great. So here's my initial feedback:

      - The Mac build you provided doesn't work for me. It hangs on the loading screen.
      Could we get some more information about the machine?  Using the python from the venv directory, are you able to run the app directly? 
      cd /Applications/pgAdmin.app/Contents/Resources/app/ 
      venv/bin/python web/pgAdmin4.py
      
      Do you get and error?
      We are setting PGADMIN_PORT, PGADMIN_KEY and SERVER_MODE environment variables prior to starting it.
       
       
      - A number of the changes are related to the naming of requirejs. I'd be inclined to pull that out into a separate patch and get it committed to master ASAP.
      This change only makes sense in the Electron context. Neverthless fell free to add it to master if you think it is relevant.


      - I think the build instructions need to be more generic (particularly on macOS). For example, I do not use HomeBrew (largely due to some nasty security issues they had in the past). I was able to mostly port the instructions and build script over to work using MacPorts (without PyEnv) which actually turned out to be somewhat more simple than what's there now.
      Since we don't use MacPorts, we cannot provide installation instructions.


      - I'm not sure what this is intended to do: "git checkout electron". Clearly that isn't correct.
      That was the name of our development branch.  It can be removed.
       

      - All new builds should be using Python 3.6. We need to deprecate 2.7 as there are some Unicode related issues that cannot be fixed in it.
      For Windows, we are using 2.7 because of external library compilation issues.   Let us know if you are able to get around this or how to make this work.
       
      - I would like to see the new build code adapted to follow the existing conventions as much as reasonable, to avoid having to change build systems or other processes/procedures that folks use. For example, build scripts should be under pkg/, completed packages left in dist/, build staging done in xxx-build directories rather than elsewhere.
      That sounds reasonable.
       
      - It may be a result of my use of MacPorts, but I'm getting the following failure building: 

      yarn run v1.3.2
      $ electron-forge make --platfrom=darwin --arch=x64 --targets=dmg
      ✔ Checking your system
      ✔ Resolving Forge Config
      We need to package your application before we can make it
      ✔ Preparing to Package Application for arch: x64
      ⠼ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml
      Compiling /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml resulted in a MIME type of application/xml, which we don't know how to handle
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js: Unexpected token (6:7)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js: Unexpected token (5:6)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js: Unexpected token (37:1)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js: Unexpected token (28:23)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js: Unexpected token, expected ; (2:29)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alert.scss
      Error: Undefined variable: "$color-green-3".
              on line 29 of /stdin
      >>   background: $color-green-3;

         --------------^

      ⠙ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alertify.overrides.scss
      Error: ".ajs-message.ajs-error.ajs-visible" failed to @extend ".bg-red-1".
             The selector ".bg-red-1" was not found.
             Use "@extend .bg-red-1 !optional" if the extend should be able to fail.
              on line 164 of /stdin
      >>   @extend .bg-red-1;

         ----------^

      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/sqleditor/_history.scss
      Error: Undefined variable: "$color-gray-3".
              on line 4 of /stdin
      >>     border-bottom: 1px solid $color-gray-3;

         -----------------------------^
      We were also seeing these errors but they don't have any impact on the compilation and should be addressed in the future (not in this patch)
       

      ⠇ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html:inline_1.js: Unexpected token (2:13)
      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js: Unexpected token (2:10)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js: Unexpected token (3:15)
      ✔ Compiling Application
      ✔ Preparing native dependencies
      ✔ Packaging Application
      Making for the following targets:
      ⠋ Making for target: dmg - On platform: darwin - For arch: x64
      An unhandled exception has occurred inside Forge:
      Cannot find module 'macos-alias'
      Error: Cannot find module 'macos-alias'
      This may be related to using MacPorts or the way you installed the dependencies.  There was a bug with Electron and Node 10 so we had to use to Node 8 with Yarn.
       
      Thanks,

      Victoria & Joao

      Re: [pgadmin][patch] Electron version 4.X

      From
      Dave Page
      Date:
      Hi

      On Fri, Jun 8, 2018 at 3:49 PM, Victoria Henry <vhenry@pivotal.io> wrote:


      On Tue, Jun 5, 2018 at 12:28 PM Dave Page <dpage@pgadmin.org> wrote:
      Hi

      On Mon, Jun 4, 2018 at 10:27 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:

      Hi Hackers,

      Attached you can find the patch that introduces electron to our code base.

      Cool. FYI, I'd like to get this into rough shape and then push it to a dev branch for fine-tuning. I think it'll be easier to work that way.
      Sure, you can create a dev branch and push this patch to it.

      Great. So here's my initial feedback:

      - The Mac build you provided doesn't work for me. It hangs on the loading screen.
      Could we get some more information about the machine?  Using the python from the venv directory, are you able to run the app directly? 
      cd /Applications/pgAdmin.app/Contents/Resources/app/ 
      venv/bin/python web/pgAdmin4.py
      
      Do you get and error?
      We are setting PGADMIN_PORT, PGADMIN_KEY and SERVER_MODE environment variables prior to starting it.

      Yes, I get:

      piranha:app dpage$ venv/bin/python web/pgAdmin4.py

      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

      ModuleNotFoundError: No module named 'encodings'


      Current thread 0x00007fffe86993c0 (most recent call first):

      Abort trap: 6


       
       
       
      - A number of the changes are related to the naming of requirejs. I'd be inclined to pull that out into a separate patch and get it committed to master ASAP.
      This change only makes sense in the Electron context. Neverthless fell free to add it to master if you think it is relevant.


      - I think the build instructions need to be more generic (particularly on macOS). For example, I do not use HomeBrew (largely due to some nasty security issues they had in the past). I was able to mostly port the instructions and build script over to work using MacPorts (without PyEnv) which actually turned out to be somewhat more simple than what's there now.
      Since we don't use MacPorts, we cannot provide installation instructions.

      I wasn't asking you to provide MacPort instructions; I can do that. I was saying that the basic outline of the instructions should be agnostic to the package tools the user might choose; e.g.

      - Install python
      - Create a virtual environment using the --copies option called venv
      - Move the virtual environment to ...

      We can then include examples of how to do that with brew, macports etc.
       


      - I'm not sure what this is intended to do: "git checkout electron". Clearly that isn't correct.
      That was the name of our development branch.  It can be removed.

      OK.
       
       

      - All new builds should be using Python 3.6. We need to deprecate 2.7 as there are some Unicode related issues that cannot be fixed in it.
      For Windows, we are using 2.7 because of external library compilation issues.   Let us know if you are able to get around this or how to make this work.

      There are a couple of tricks if you're using Python 3.6. First, to compile Pycrypto you need to do something like:

      Beforehand. Then, edit Lib\site-packages\Crypto\Random\OSRNG\nt.py" and modify " import winrandom" to "from . import winrandom".

      As a sidenote, I use the VC++ 2015 Build Tools compiler from Microsoft, without installing any SDKs or Visual Studio.
       
       
      - I would like to see the new build code adapted to follow the existing conventions as much as reasonable, to avoid having to change build systems or other processes/procedures that folks use. For example, build scripts should be under pkg/, completed packages left in dist/, build staging done in xxx-build directories rather than elsewhere.
      That sounds reasonable.
       
      - It may be a result of my use of MacPorts, but I'm getting the following failure building: 

      yarn run v1.3.2
      $ electron-forge make --platfrom=darwin --arch=x64 --targets=dmg
      ✔ Checking your system
      ✔ Resolving Forge Config
      We need to package your application before we can make it
      ✔ Preparing to Package Application for arch: x64
      ⠼ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml
      Compiling /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml resulted in a MIME type of application/xml, which we don't know how to handle
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js: Unexpected token (6:7)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js: Unexpected token (5:6)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js: Unexpected token (37:1)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js: Unexpected token (28:23)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js: Unexpected token, expected ; (2:29)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alert.scss
      Error: Undefined variable: "$color-green-3".
              on line 29 of /stdin
      >>   background: $color-green-3;

         --------------^

      ⠙ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alertify.overrides.scss
      Error: ".ajs-message.ajs-error.ajs-visible" failed to @extend ".bg-red-1".
             The selector ".bg-red-1" was not found.
             Use "@extend .bg-red-1 !optional" if the extend should be able to fail.
              on line 164 of /stdin
      >>   @extend .bg-red-1;

         ----------^

      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/sqleditor/_history.scss
      Error: Undefined variable: "$color-gray-3".
              on line 4 of /stdin
      >>     border-bottom: 1px solid $color-gray-3;

         -----------------------------^
      We were also seeing these errors but they don't have any impact on the compilation and should be addressed in the future (not in this patch)
       

      ⠇ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html:inline_1.js: Unexpected token (2:13)
      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js: Unexpected token (2:10)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js: Unexpected token (3:15)
      ✔ Compiling Application
      ✔ Preparing native dependencies
      ✔ Packaging Application
      Making for the following targets:
      ⠋ Making for target: dmg - On platform: darwin - For arch: x64
      An unhandled exception has occurred inside Forge:
      Cannot find module 'macos-alias'
      Error: Cannot find module 'macos-alias'
      This may be related to using MacPorts or the way you installed the dependencies.  There was a bug with Electron and Node 10 so we had to use to Node 8 with Yarn.

      I'm using Node 8 as well. Let's figure out your build first and ensure we can get that working everywhere, then I'll try to figure out how to reproduce it.  

      --
      Dave Page
      Blog: http://pgsnake.blogspot.com
      Twitter: @pgsnake

      EnterpriseDB UK: http://www.enterprisedb.com
      The Enterprise PostgreSQL Company

      Re: [pgadmin][patch] Electron version 4.X

      From
      Victoria Henry
      Date:
      Hi Hackers,

      Attached is a revised patch with the following changes:

      • updated the README
      • moved the build scripts to the pkg folder
      • storing the out files in dist/arch/
      • fix the mac build so it no longer stalls on loading

      Here is a link to the updated mac binary:

      Let us know what you think.

      Sincerely,

      Victoria && Joao

      On Mon, Jun 11, 2018 at 11:35 AM Dave Page <dpage@pgadmin.org> wrote:
      Hi

      On Fri, Jun 8, 2018 at 3:49 PM, Victoria Henry <vhenry@pivotal.io> wrote:


      On Tue, Jun 5, 2018 at 12:28 PM Dave Page <dpage@pgadmin.org> wrote:
      Hi

      On Mon, Jun 4, 2018 at 10:27 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:

      Hi Hackers,

      Attached you can find the patch that introduces electron to our code base.

      Cool. FYI, I'd like to get this into rough shape and then push it to a dev branch for fine-tuning. I think it'll be easier to work that way.
      Sure, you can create a dev branch and push this patch to it.

      Great. So here's my initial feedback:

      - The Mac build you provided doesn't work for me. It hangs on the loading screen.
      Could we get some more information about the machine?  Using the python from the venv directory, are you able to run the app directly? 
      cd /Applications/pgAdmin.app/Contents/Resources/app/ 
      venv/bin/python web/pgAdmin4.py
      
      Do you get and error?
      We are setting PGADMIN_PORT, PGADMIN_KEY and SERVER_MODE environment variables prior to starting it.

      Yes, I get:

      piranha:app dpage$ venv/bin/python web/pgAdmin4.py

      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

      ModuleNotFoundError: No module named 'encodings'


      Current thread 0x00007fffe86993c0 (most recent call first):

      Abort trap: 6


       
       
       
      - A number of the changes are related to the naming of requirejs. I'd be inclined to pull that out into a separate patch and get it committed to master ASAP.
      This change only makes sense in the Electron context. Neverthless fell free to add it to master if you think it is relevant.


      - I think the build instructions need to be more generic (particularly on macOS). For example, I do not use HomeBrew (largely due to some nasty security issues they had in the past). I was able to mostly port the instructions and build script over to work using MacPorts (without PyEnv) which actually turned out to be somewhat more simple than what's there now.
      Since we don't use MacPorts, we cannot provide installation instructions.

      I wasn't asking you to provide MacPort instructions; I can do that. I was saying that the basic outline of the instructions should be agnostic to the package tools the user might choose; e.g.

      - Install python
      - Create a virtual environment using the --copies option called venv
      - Move the virtual environment to ...

      We can then include examples of how to do that with brew, macports etc.
       


      - I'm not sure what this is intended to do: "git checkout electron". Clearly that isn't correct.
      That was the name of our development branch.  It can be removed.

      OK.
       
       

      - All new builds should be using Python 3.6. We need to deprecate 2.7 as there are some Unicode related issues that cannot be fixed in it.
      For Windows, we are using 2.7 because of external library compilation issues.   Let us know if you are able to get around this or how to make this work.

      There are a couple of tricks if you're using Python 3.6. First, to compile Pycrypto you need to do something like:

      Beforehand. Then, edit Lib\site-packages\Crypto\Random\OSRNG\nt.py" and modify " import winrandom" to "from . import winrandom".

      As a sidenote, I use the VC++ 2015 Build Tools compiler from Microsoft, without installing any SDKs or Visual Studio.
       
       
      - I would like to see the new build code adapted to follow the existing conventions as much as reasonable, to avoid having to change build systems or other processes/procedures that folks use. For example, build scripts should be under pkg/, completed packages left in dist/, build staging done in xxx-build directories rather than elsewhere.
      That sounds reasonable.
       
      - It may be a result of my use of MacPorts, but I'm getting the following failure building: 

      yarn run v1.3.2
      $ electron-forge make --platfrom=darwin --arch=x64 --targets=dmg
      ✔ Checking your system
      ✔ Resolving Forge Config
      We need to package your application before we can make it
      ✔ Preparing to Package Application for arch: x64
      ⠼ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml
      Compiling /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml resulted in a MIME type of application/xml, which we don't know how to handle
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js: Unexpected token (6:7)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js: Unexpected token (5:6)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js: Unexpected token (37:1)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js: Unexpected token (28:23)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js: Unexpected token, expected ; (2:29)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alert.scss
      Error: Undefined variable: "$color-green-3".
              on line 29 of /stdin
      >>   background: $color-green-3;

         --------------^

      ⠙ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alertify.overrides.scss
      Error: ".ajs-message.ajs-error.ajs-visible" failed to @extend ".bg-red-1".
             The selector ".bg-red-1" was not found.
             Use "@extend .bg-red-1 !optional" if the extend should be able to fail.
              on line 164 of /stdin
      >>   @extend .bg-red-1;

         ----------^

      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/sqleditor/_history.scss
      Error: Undefined variable: "$color-gray-3".
              on line 4 of /stdin
      >>     border-bottom: 1px solid $color-gray-3;

         -----------------------------^
      We were also seeing these errors but they don't have any impact on the compilation and should be addressed in the future (not in this patch)
       

      ⠇ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html:inline_1.js: Unexpected token (2:13)
      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js: Unexpected token (2:10)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js: Unexpected token (3:15)
      ✔ Compiling Application
      ✔ Preparing native dependencies
      ✔ Packaging Application
      Making for the following targets:
      ⠋ Making for target: dmg - On platform: darwin - For arch: x64
      An unhandled exception has occurred inside Forge:
      Cannot find module 'macos-alias'
      Error: Cannot find module 'macos-alias'
      This may be related to using MacPorts or the way you installed the dependencies.  There was a bug with Electron and Node 10 so we had to use to Node 8 with Yarn.

      I'm using Node 8 as well. Let's figure out your build first and ensure we can get that working everywhere, then I'll try to figure out how to reproduce it.  

      --
      Dave Page
      Blog: http://pgsnake.blogspot.com
      Twitter: @pgsnake

      EnterpriseDB UK: http://www.enterprisedb.com
      The Enterprise PostgreSQL Company
      Attachment

      Re: [pgadmin][patch] Electron version 4.X

      From
      Victoria Henry
      Date:
      Hi Hackers,

      Please disregard the previous patch (version 2).
      Attached is the electron patch version 3.

      Sincerely,

      Joao && Victoria

      On Tue, Jun 12, 2018 at 3:04 PM Victoria Henry <vhenry@pivotal.io> wrote:
      Hi Hackers,

      Attached is a revised patch with the following changes:

      • updated the README
      • moved the build scripts to the pkg folder
      • storing the out files in dist/arch/
      • fix the mac build so it no longer stalls on loading

      Here is a link to the updated mac binary:

      Let us know what you think.

      Sincerely,

      Victoria && Joao

      On Mon, Jun 11, 2018 at 11:35 AM Dave Page <dpage@pgadmin.org> wrote:
      Hi

      On Fri, Jun 8, 2018 at 3:49 PM, Victoria Henry <vhenry@pivotal.io> wrote:


      On Tue, Jun 5, 2018 at 12:28 PM Dave Page <dpage@pgadmin.org> wrote:
      Hi

      On Mon, Jun 4, 2018 at 10:27 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:

      Hi Hackers,

      Attached you can find the patch that introduces electron to our code base.

      Cool. FYI, I'd like to get this into rough shape and then push it to a dev branch for fine-tuning. I think it'll be easier to work that way.
      Sure, you can create a dev branch and push this patch to it.

      Great. So here's my initial feedback:

      - The Mac build you provided doesn't work for me. It hangs on the loading screen.
      Could we get some more information about the machine?  Using the python from the venv directory, are you able to run the app directly? 
      cd /Applications/pgAdmin.app/Contents/Resources/app/ 
      venv/bin/python web/pgAdmin4.py
      
      Do you get and error?
      We are setting PGADMIN_PORT, PGADMIN_KEY and SERVER_MODE environment variables prior to starting it.

      Yes, I get:

      piranha:app dpage$ venv/bin/python web/pgAdmin4.py

      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

      ModuleNotFoundError: No module named 'encodings'


      Current thread 0x00007fffe86993c0 (most recent call first):

      Abort trap: 6


       
       
       
      - A number of the changes are related to the naming of requirejs. I'd be inclined to pull that out into a separate patch and get it committed to master ASAP.
      This change only makes sense in the Electron context. Neverthless fell free to add it to master if you think it is relevant.


      - I think the build instructions need to be more generic (particularly on macOS). For example, I do not use HomeBrew (largely due to some nasty security issues they had in the past). I was able to mostly port the instructions and build script over to work using MacPorts (without PyEnv) which actually turned out to be somewhat more simple than what's there now.
      Since we don't use MacPorts, we cannot provide installation instructions.

      I wasn't asking you to provide MacPort instructions; I can do that. I was saying that the basic outline of the instructions should be agnostic to the package tools the user might choose; e.g.

      - Install python
      - Create a virtual environment using the --copies option called venv
      - Move the virtual environment to ...

      We can then include examples of how to do that with brew, macports etc.
       


      - I'm not sure what this is intended to do: "git checkout electron". Clearly that isn't correct.
      That was the name of our development branch.  It can be removed.

      OK.
       
       

      - All new builds should be using Python 3.6. We need to deprecate 2.7 as there are some Unicode related issues that cannot be fixed in it.
      For Windows, we are using 2.7 because of external library compilation issues.   Let us know if you are able to get around this or how to make this work.

      There are a couple of tricks if you're using Python 3.6. First, to compile Pycrypto you need to do something like:

      Beforehand. Then, edit Lib\site-packages\Crypto\Random\OSRNG\nt.py" and modify " import winrandom" to "from . import winrandom".

      As a sidenote, I use the VC++ 2015 Build Tools compiler from Microsoft, without installing any SDKs or Visual Studio.
       
       
      - I would like to see the new build code adapted to follow the existing conventions as much as reasonable, to avoid having to change build systems or other processes/procedures that folks use. For example, build scripts should be under pkg/, completed packages left in dist/, build staging done in xxx-build directories rather than elsewhere.
      That sounds reasonable.
       
      - It may be a result of my use of MacPorts, but I'm getting the following failure building: 

      yarn run v1.3.2
      $ electron-forge make --platfrom=darwin --arch=x64 --targets=dmg
      ✔ Checking your system
      ✔ Resolving Forge Config
      We need to package your application before we can make it
      ✔ Preparing to Package Application for arch: x64
      ⠼ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml
      Compiling /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml resulted in a MIME type of application/xml, which we don't know how to handle
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js: Unexpected token (6:7)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js: Unexpected token (5:6)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js: Unexpected token (37:1)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js: Unexpected token (28:23)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js: Unexpected token, expected ; (2:29)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alert.scss
      Error: Undefined variable: "$color-green-3".
              on line 29 of /stdin
      >>   background: $color-green-3;

         --------------^

      ⠙ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alertify.overrides.scss
      Error: ".ajs-message.ajs-error.ajs-visible" failed to @extend ".bg-red-1".
             The selector ".bg-red-1" was not found.
             Use "@extend .bg-red-1 !optional" if the extend should be able to fail.
              on line 164 of /stdin
      >>   @extend .bg-red-1;

         ----------^

      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/sqleditor/_history.scss
      Error: Undefined variable: "$color-gray-3".
              on line 4 of /stdin
      >>     border-bottom: 1px solid $color-gray-3;

         -----------------------------^
      We were also seeing these errors but they don't have any impact on the compilation and should be addressed in the future (not in this patch)
       

      ⠇ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html:inline_1.js: Unexpected token (2:13)
      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js: Unexpected token (2:10)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js: Unexpected token (3:15)
      ✔ Compiling Application
      ✔ Preparing native dependencies
      ✔ Packaging Application
      Making for the following targets:
      ⠋ Making for target: dmg - On platform: darwin - For arch: x64
      An unhandled exception has occurred inside Forge:
      Cannot find module 'macos-alias'
      Error: Cannot find module 'macos-alias'
      This may be related to using MacPorts or the way you installed the dependencies.  There was a bug with Electron and Node 10 so we had to use to Node 8 with Yarn.

      I'm using Node 8 as well. Let's figure out your build first and ensure we can get that working everywhere, then I'll try to figure out how to reproduce it.  

      --
      Dave Page
      Blog: http://pgsnake.blogspot.com
      Twitter: @pgsnake

      EnterpriseDB UK: http://www.enterprisedb.com
      The Enterprise PostgreSQL Company
      Attachment

      Re: [pgadmin][patch] Electron version 4.X

      From
      Dave Page
      Date:
      Hi

      On Tue, Jun 12, 2018 at 8:04 PM, Victoria Henry <vhenry@pivotal.io> wrote:
      Hi Hackers,

      Attached is a revised patch with the following changes:

      • updated the README
      • moved the build scripts to the pkg folder
      • storing the out files in dist/arch/
      • fix the mac build so it no longer stalls on loading

      Here is a link to the updated mac binary:

      Looks good!

      I've pushed your most recent patch along with some minor tweaks to a new "electron" branch. The changes were:

      - Use "pgAdmin" on menus
      - Update the .gitignore file
      - Remove the existing runtime
      - add "macos-alias" to the package.json file

      I've also created a rough TODO list at https://redmine.postgresql.org/projects/pgadmin4/wiki/Electron_TODO_list to keep an eye on outstanding items. Please add anything you have.

      I intend to spend time on this as and when I can.

      Thanks!
       


      Let us know what you think.

      Sincerely,

      Victoria && Joao

      On Mon, Jun 11, 2018 at 11:35 AM Dave Page <dpage@pgadmin.org> wrote:
      Hi

      On Fri, Jun 8, 2018 at 3:49 PM, Victoria Henry <vhenry@pivotal.io> wrote:


      On Tue, Jun 5, 2018 at 12:28 PM Dave Page <dpage@pgadmin.org> wrote:
      Hi

      On Mon, Jun 4, 2018 at 10:27 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:

      Hi Hackers,

      Attached you can find the patch that introduces electron to our code base.

      Cool. FYI, I'd like to get this into rough shape and then push it to a dev branch for fine-tuning. I think it'll be easier to work that way.
      Sure, you can create a dev branch and push this patch to it.

      Great. So here's my initial feedback:

      - The Mac build you provided doesn't work for me. It hangs on the loading screen.
      Could we get some more information about the machine?  Using the python from the venv directory, are you able to run the app directly? 
      cd /Applications/pgAdmin.app/Contents/Resources/app/ 
      venv/bin/python web/pgAdmin4.py
      
      Do you get and error?
      We are setting PGADMIN_PORT, PGADMIN_KEY and SERVER_MODE environment variables prior to starting it.

      Yes, I get:

      piranha:app dpage$ venv/bin/python web/pgAdmin4.py

      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

      ModuleNotFoundError: No module named 'encodings'


      Current thread 0x00007fffe86993c0 (most recent call first):

      Abort trap: 6


       
       
       
      - A number of the changes are related to the naming of requirejs. I'd be inclined to pull that out into a separate patch and get it committed to master ASAP.
      This change only makes sense in the Electron context. Neverthless fell free to add it to master if you think it is relevant.


      - I think the build instructions need to be more generic (particularly on macOS). For example, I do not use HomeBrew (largely due to some nasty security issues they had in the past). I was able to mostly port the instructions and build script over to work using MacPorts (without PyEnv) which actually turned out to be somewhat more simple than what's there now.
      Since we don't use MacPorts, we cannot provide installation instructions.

      I wasn't asking you to provide MacPort instructions; I can do that. I was saying that the basic outline of the instructions should be agnostic to the package tools the user might choose; e.g.

      - Install python
      - Create a virtual environment using the --copies option called venv
      - Move the virtual environment to ...

      We can then include examples of how to do that with brew, macports etc.
       


      - I'm not sure what this is intended to do: "git checkout electron". Clearly that isn't correct.
      That was the name of our development branch.  It can be removed.

      OK.
       
       

      - All new builds should be using Python 3.6. We need to deprecate 2.7 as there are some Unicode related issues that cannot be fixed in it.
      For Windows, we are using 2.7 because of external library compilation issues.   Let us know if you are able to get around this or how to make this work.

      There are a couple of tricks if you're using Python 3.6. First, to compile Pycrypto you need to do something like:

      Beforehand. Then, edit Lib\site-packages\Crypto\Random\OSRNG\nt.py" and modify " import winrandom" to "from . import winrandom".

      As a sidenote, I use the VC++ 2015 Build Tools compiler from Microsoft, without installing any SDKs or Visual Studio.
       
       
      - I would like to see the new build code adapted to follow the existing conventions as much as reasonable, to avoid having to change build systems or other processes/procedures that folks use. For example, build scripts should be under pkg/, completed packages left in dist/, build staging done in xxx-build directories rather than elsewhere.
      That sounds reasonable.
       
      - It may be a result of my use of MacPorts, but I'm getting the following failure building: 

      yarn run v1.3.2
      $ electron-forge make --platfrom=darwin --arch=x64 --targets=dmg
      ✔ Checking your system
      ✔ Resolving Forge Config
      We need to package your application before we can make it
      ✔ Preparing to Package Application for arch: x64
      ⠼ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml
      Compiling /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/venv/lib/python3.6/site-packages/setuptools/command/launcher manifest.xml resulted in a MIME type of application/xml, which we don't know how to handle
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/server_groups/servers/templates/servers/supported_servers.js: Unexpected token (6:7)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/endpoints.js: Unexpected token (5:6)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/messages.js: Unexpected token (37:1)
      Failed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/browser/templates/browser/js/utils.js: Unexpected token (28:23)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/misc/file_manager/templates/file_manager/js/languages/en.js: Unexpected token, expected ; (2:29)
      ⠋ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alert.scss
      Error: Undefined variable: "$color-green-3".
              on line 29 of /stdin
      >>   background: $color-green-3;

         --------------^

      ⠙ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/_alertify.overrides.scss
      Error: ".ajs-message.ajs-error.ajs-visible" failed to @extend ".bg-red-1".
             The selector ".bg-red-1" was not found.
             Use "@extend .bg-red-1 !optional" if the extend should be able to fail.
              on line 164 of /stdin
      >>   @extend .bg-red-1;

         ----------^

      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/static/scss/sqleditor/_history.scss
      Error: Undefined variable: "$color-gray-3".
              on line 4 of /stdin
      >>     border-bottom: 1px solid $color-gray-3;

         -----------------------------^
      We were also seeing these errors but they don't have any impact on the compilation and should be addressed in the future (not in this patch)
       

      ⠇ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/templates/base.html:inline_1.js: Unexpected token (2:13)
      ⠴ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/templates/js/translations.js: Unexpected token (2:10)
      ⠦ Compiling ApplicationFailed to compile file: /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js
      /var/folders/c6/pwf0k2d509s2xx6vh0h633vm0000gn/T/electron-packager/darwin-x64/pgAdmin-darwin-x64/Electron.app/Contents/Resources/app/web/pgadmin/tools/user_management/templates/user_management/js/current_user.js: Unexpected token (3:15)
      ✔ Compiling Application
      ✔ Preparing native dependencies
      ✔ Packaging Application
      Making for the following targets:
      ⠋ Making for target: dmg - On platform: darwin - For arch: x64
      An unhandled exception has occurred inside Forge:
      Cannot find module 'macos-alias'
      Error: Cannot find module 'macos-alias'
      This may be related to using MacPorts or the way you installed the dependencies.  There was a bug with Electron and Node 10 so we had to use to Node 8 with Yarn.

      I'm using Node 8 as well. Let's figure out your build first and ensure we can get that working everywhere, then I'll try to figure out how to reproduce it.  

      --
      Dave Page
      Blog: http://pgsnake.blogspot.com
      Twitter: @pgsnake

      EnterpriseDB UK: http://www.enterprisedb.com
      The Enterprise PostgreSQL Company



      --
      Dave Page
      Blog: http://pgsnake.blogspot.com
      Twitter: @pgsnake

      EnterpriseDB UK: http://www.enterprisedb.com
      The Enterprise PostgreSQL Company

      Re: [pgadmin][patch] Electron version 4.X

      From
      Dave Page
      Date:
      Hi

      On Fri, Jun 8, 2018 at 3:49 PM, Victoria Henry <vhenry@pivotal.io> wrote:
       
      - I think the build instructions need to be more generic (particularly on macOS). For example, I do not use HomeBrew (largely due to some nasty security issues they had in the past). I was able to mostly port the instructions and build script over to work using MacPorts (without PyEnv) which actually turned out to be somewhat more simple than what's there now.
      Since we don't use MacPorts, we cannot provide installation instructions.

      FYI, I just tried Homebrew again to see if it has improved. It has not:

      dpage@snake:~/git$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

      ==> This script will install:

      /usr/local/bin/brew

      /usr/local/share/doc/homebrew

      /usr/local/share/man/man1/brew.1

      /usr/local/share/zsh/site-functions/_brew

      /usr/local/etc/bash_completion.d/brew

      /usr/local/Homebrew

      ==> The following existing directories will be made group writable:

      /usr/local/bin

      /usr/local/include

      /usr/local/lib

      /usr/local/share

      /usr/local/share/man

      ==> The following existing directories will have their owner set to dpage:

      /usr/local/bin

      /usr/local/include

      /usr/local/lib

      /usr/local/share

      /usr/local/share/man

      ==> The following existing directories will have their group set to admin:

      /usr/local/bin

      /usr/local/include

      /usr/local/lib

      /usr/local/share

      /usr/local/share/man

      ==> The following new directories will be created:

      /usr/local/Cellar

      /usr/local/Homebrew

      /usr/local/Frameworks

      /usr/local/etc

      /usr/local/opt

      /usr/local/sbin

      /usr/local/share/zsh

      /usr/local/share/zsh/site-functions

      /usr/local/var

      As anyone familiar with Unix system architecture could tell you, this is a horribly bad idea for a number of reasons:

      1) It will break on any system used by more than one person - only the original installer (and possible members of the admin group) will be able to properly use brew.

      2) It's changing the default (and correct) permissions on /usr/local/ to something they are not supposed to be.

      3) It's making a directory that is in the path writeable by user other than root. This is a very bad idea as it means that any malicious software run by the user could place executable files there without the user's knowledge.

      /usr/local/ is supposed to be a secure directory for very good reasons. We cannot start recommending our devs do something that compromises the security of their system to build pgAdmin, thus we need to figure out how to do this using MacPorts or some other similar technology that doesn't suffer from this problem.

      I'm leaning towards the idea that having any build instructions that suggest using brew should be removed from pgAdmin entirely, to avoid putting users at risk.
       
      --
      Dave Page
      Blog: http://pgsnake.blogspot.com
      Twitter: @pgsnake

      EnterpriseDB UK: http://www.enterprisedb.com
      The Enterprise PostgreSQL Company