[Sugar-devel] Proxy Settings Feature in the recent versions of sugar

James Cameron quozl at laptop.org
Tue Mar 15 17:57:29 EDT 2016


On Wed, Mar 16, 2016 at 01:57:06AM +0530, Manash Raja wrote:
> Dear James,
> 
> Regarding moving to src/jarabe/main.py , as far as I know, there
> isn't a direct way for python to set the required environment
> variables (http_proxy) and make it accessible to all other
> processes. The various method in python for editing the environment
> variables, keeps the changes limited to only that process or its
> child processes. Hence if the implementation is done through
> main.py, other files to run bash scripts have to be introduced.

I disagree.  src/jarabe/main.py already sets several environment
variables that are inherited by activity processes, so there is no
need to run shell scripts.  You should test again.  Take particular
note of variables such as SUGAR_VERSION, and TZ.

SUGAR_VERSION is set during startup with this;

os.environ['SUGAR_VERSION'] = config.version

TZ is set by reading a Gio.Settings instance with this;

def setup_timezone():
    settings = Gio.Settings('org.sugarlabs.date')
    timezone = settings.get_string('timezone')
    if timezone is not None and timezone:
        os.environ['TZ'] = timezone

There is no benefit to using /usr/bin/sugar instead, and your proposed
change is very resource intensive because of multiple activation of
gsettings binary.

> So, to me it seems exporting proxy settings to the environment
> variables at /usr/bin/sugar is a fine implementation. Though we can
> use variables to reduce gsettings calls in that file.
> 
> I would definitely look at the branch based development from next time.
> 
> Tell me if I shall reduce gsettings call in /usr/bin/sugar file and continue
> with the present implementation or look for any other implementation that you
> suggest. Once the feature is final for merge, I will collapse/rebase the
> commits with new commit message and update the PR.
> 
> Thanks.
> 
> Regards.
> Manash Pratim Das (ManashRaja)
> 
> On Tue, Mar 15, 2016 at 10:39 AM, James Cameron <[1]quozl at laptop.org> wrote:
> 
>     Thanks, that's interesting.
> 
>     Your /usr/bin/sugar (aka bin/[2]sugar.in) will run gsettings many times,
>     and this is inefficient, causing unnecessary delay during startup.
>     Perhaps if you move this into src/jarabe/main.py which already uses
>     Gio.Settings?
> 
>     You have worked on your master branch and the pull request is
>     associated with that branch.  That's unusual.  It is more common to
>     use a new branch with a name that explains the feature.  Make a note
>     of that for next time.
> 
>     Your pull request has three commits; 09d363f, 682d0b2, 4fe1a2f.
>     Before merging, we will ask for these and later commits to be
>     collapsed, rebased, or re-written.  You may also combine and rewrite
>     the commit messages.  Then a push with --force will update the pull
>     request.
> 
>     The [3]http://wiki.sugarlabs.org/go/Features/Proxy_Settings page is on a
>     Wiki, and any change can be rolled back.
>    
>     On Tue, Mar 15, 2016 at 09:58:31AM +0530, Manash Raja wrote:
>     > Hi,
>     >
>     > I thank you all for the guidance.
>     >
>     > I modified my PR as per your suggestions and now the implementation of
>     the
>     > proxy feature is far better.
>     > @Sam, as you suggested, I have now completely removed the need of
>     re-writing
>     > "proxy.sh" every time the settings changes and am using
>     > "org.gnome.system.proxy" schemas. Now "/usr/bin/sugar" is hard-coded to
>     read
>     > the proxy settings from "org.gnome.system.proxy" and export it to the
>     > environment variables required for the proxy settings to be available
>     easily.
>     >
>     > @Gonzalo, thanks for the link to that important patch from Manuel
>     Quiñones. And
>     > @James, I have changed my "view.py" and "model.py" files to go with 
>     Manuel
>     > Quiñones' way of setting the "org.gnome.system.proxy" schemas via
>     GSettings.
>     > This has hence removed the dependence on polkit for file write
>     permissions and
>     > made us do away with extra files like "set_proxy.py" for running root
>     permitted
>     > scripts.
>     >
>     > Also I have removed the "logout.sh" script as now I am using the pre-made
>     > "require-restart" feature present in "sectionview" which asks the user
>     for
>     > restart.
>     >
>     > Also @James, shall I now therefore submit the GUI changes and the changes
>     you
>     > proposed to for this update in the features page? [1][4]
>     wiki.sugarlabs.org/go/
>     > Features/Proxy_Settings
>     >
>     > Here is the patch I submitted: [2][5]https://github.com/ManashRaja/sugar/
>     commit/
>     > 4fe1a2fea7f37d036331c1a1ae736c88cc29d62d
>     >
>     > Thanks
>     > Regards
>     > Manash Pratim Das
>     >
>     > On Mon, Mar 14, 2016 at 8:03 AM, James Cameron <[3][6]quozl at laptop.org>
>     wrote:
>     >
>     >     On Sun, Mar 13, 2016 at 11:18:46PM -0300, Gonzalo Odiard wrote:
>     >     > On Sun, Mar 13, 2016 at 11:09 PM, Jerry Vonau <[1][4][7]
>     me at jvonau.ca> wrote:
>     >     >
>     >     > > Yea that has roots to the old ActivityCentral fork, any reason
>     >     > > why this has not been 'upstreamed' from OneEducation(OLPC-AU) to
>     >     > > SugarLabs?
>     >     >
>     >     > Yes. Was not accepted by sugar upstream.
>     >
>     >     Let's have another go then.  See what the objections are from the
>     >     current set of developers.
>     >
>     >     > I upstreamed all that was possible, the only changes that were
>     >     > developed just for OLPC-AU were the changes needed to deal with the
>     >     > complex network environments common in Australian schools.
>     >
>     >     This disease is spreading.
>     >
>     >     --
>     >     James Cameron
>     >     [5][8]http://quozl.netrek.org/
>     >     _______________________________________________
>     >     Sugar-devel mailing list
>     >     [6][9]Sugar-devel at lists.sugarlabs.org
>     >     [7][10]http://lists.sugarlabs.org/listinfo/sugar-devel
>     >
>     > References:
>     >
>     > [1] [11]http://wiki.sugarlabs.org/go/Features/Proxy_Settings
>     > [2] [12]https://github.com/ManashRaja/sugar/commit/
>     4fe1a2fea7f37d036331c1a1ae736c88cc29d62d
>     > [3] mailto:[13]quozl at laptop.org
>     > [4] mailto:[14]me at jvonau.ca
>     > [5] [15]http://quozl.netrek.org/
>     > [6] mailto:[16]Sugar-devel at lists.sugarlabs.org
>     > [7] [17]http://lists.sugarlabs.org/listinfo/sugar-devel
> 
>     --
>     James Cameron
>     [18]http://quozl.netrek.org/
> 
> References:
> 
> [1] mailto:quozl at laptop.org
> [2] http://sugar.in/
> [3] http://wiki.sugarlabs.org/go/Features/Proxy_Settings
> [4] http://wiki.sugarlabs.org/go/
> [5] https://github.com/ManashRaja/sugar/commit/
> [6] mailto:quozl at laptop.org
> [7] mailto:me at jvonau.ca
> [8] http://quozl.netrek.org/
> [9] mailto:Sugar-devel at lists.sugarlabs.org
> [10] http://lists.sugarlabs.org/listinfo/sugar-devel
> [11] http://wiki.sugarlabs.org/go/Features/Proxy_Settings
> [12] https://github.com/ManashRaja/sugar/commit/4fe1a2fea7f37d036331c1a1ae736c88cc29d62d
> [13] mailto:quozl at laptop.org
> [14] mailto:me at jvonau.ca
> [15] http://quozl.netrek.org/
> [16] mailto:Sugar-devel at lists.sugarlabs.org
> [17] http://lists.sugarlabs.org/listinfo/sugar-devel
> [18] http://quozl.netrek.org/

-- 
James Cameron
http://quozl.netrek.org/


More information about the Sugar-devel mailing list