[Scons-dev] Distinguishing Debian and Fedora

Bill Deegan bill at baddogconsulting.com
Tue Jan 19 09:36:54 EST 2016


I'd say definitely don't change the value of env['PLATFORM'].
Introduce another variable such as env['DISTRIBUTION'] or something like
that.

I'm not sure we even need to use enums.
A simple package variable should do the trick?

SCons.Platform.Debian = "DEBIAN"

That way there's no additional packages needed.

-Bill

On Tue, Jan 19, 2016 at 8:56 AM, Jason Kenny <dragon512 at live.com> wrote:

> I think this is a great idea.
>
>
>
> However a word of warning. How this applied could break existing code
> people have.
>
>
>
> Changing the env[“PLATFORM”] from posix to something like “linux” or
> “Linux_debian” is not backward compatible.
>
>
>
> The reality is that a string was used for good or bad.
>
>
>
> I would suggest that we defined something new so we don’t break existing
> build code. I know I have suggested something from parts, but I seem to
> have to make it a 100% independent package on pypi for it to be used by
> SCons.
>
>
>
> I think we need to look at Greg’s Noel IAPAT idea. I been calling it
> settings and have a great start of it going on Parts. I don’t think we want
> do this kind of change without some thought.
>
>
>
> I personally think we should deprecate PLATFORM and replace it with a
> HOST_XXX and TARGET_XXX value. Where XXX would be values like:
>
>
>
> 1)      OS ( this is abstract)
>
> 2)      OS-VARIANT/ Vender ( this is detailed)
>
> 3)      Architecture ( this is abstract)
>
> 4)      CPU-Type( this is detailed)
>
>
>
> I have found over and over again people need, as you get more low level,
> more detail. But to much detail can be a problem if one does not provide a
> good abstraction to replace it.
>
>
>
> People need detail something like this is fedora or redhat, or the only
> need details such as this is windows or posix.
>
>
>
> I know one item I would fix in the Parts Api for SystemPlatform would have
> been to move to use of functions for the abstract layers vs string or
> enums. Functions such as isX86() or isx86_64(), or isPosix or isLinux() I
> think will work better long term as it provides way to say useful stuff
> without knowing details that might change in unexpected ways. I have
> learned what seems good today probably will not make as much sense
> tomorrow, normally for reason we cannot foresee.
>
>
>
> I should also note maintaining more detail will  have a higher maintainer
> cost.
>
>
>
> Jason
>
>
>
>
> *From: *Russel Winder <russel at winder.org.uk>
> *Sent: *Tuesday, January 19, 2016 5:42 AM
> *To: *SCons_Developers <scons-dev at scons.org>
> *Subject: *Re: [Scons-dev] Distinguishing Debian and Fedora
>
>
>
> The following is a "doodle" for the direction I think the whole
> platform detection thing should go. It is all about removing strings as
> selectors, which has to be a bad thing given the propensity of many to
> mis-spell things.
>
>
> from enum import Enum, unique
>
> @unique
> class OS_Type(Enum):
>     posix = 0
>     linux_debian = 1
>     linux_fedora = 2
>     darwin = 3
>     windows_win32 = 4
>     windows_cygwin = 5
>     windows_mingw = 6
>
> def which_posix():
>     with open('/etc/os-release') as f:
>         for line in f:
>             if 'ID' in line:
>                 return {
>                     'debian': OS_Type.linux_debian,
>                     'fedora': OS_Type.linux_fedora,
>                     }[line.split('=')[1].strip()]
>         return OS_Type.posix
>
> environment = Environment(
>     tools=('g++', 'gnulink'),
> )
>
> platform = {
>     'posix': which_posix(),
>     'darwin': OS_Type.darwin,
> }[environment['PLATFORM']]
>
> environment.MergeFlags('!pkg-config --cflags --libs gtkmm-3.0')
>
> if platform == OS_Type.linux_fedora:
>     environment.MergeFlags('!pkg-config --cflags --libs gstreamermm-
> 0.10')
> elif platform == OS_Type.linux_debian:
>     environment.MergeFlags('!pkg-config --cflags --libs gstreamermm-
> 1.0')
> else:
>     print('Platform not understood.')
>     Exit(1)
>
> environment.Program('stuff.cpp', CXXFLAGS=['-std=c++14', '-W', '-
> Wall'])
>
>
>
>
> --
> Russel.
>
> =============================================================================
> Dr Russel Winder      t: +44 20 7585 2200   voip:
> sip:russel.winder at ekiga.net
> 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
> London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
>
>
>
> _______________________________________________
> Scons-dev mailing list
> Scons-dev at scons.org
> https://pairlist2.pair.net/mailman/listinfo/scons-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20160119/2ea2377c/attachment.html>


More information about the Scons-dev mailing list