[Scons-dev] mimetypes: adding mimetype for scons scripts

Carnë Draug carandraug+dev at gmail.com
Wed Jan 21 08:05:53 EST 2015


On 21 January 2015 at 01:48, Bill Deegan <bill at baddogconsulting.com> wrote:
>
> On Tue, Jan 20, 2015 at 5:28 PM, William Blevins <wblevins001 at gmail.com>
> wrote:
>>
>> On Tue, Jan 20, 2015 at 12:58 PM, Carnë Draug <carandraug+dev at gmail.com>
>> wrote:
>>>
>>> Hi
>>>
>>> scons [1] is a build system and I was thinking of adding it to
>>> shared-mime-info.  Its files are very simple to identify, they are
>>> always named SConstruct or SConscript.  These files are also valid
>>> python scripts.
>>>
>>> Should shared-mime-info identify them (I can submit a git patch, no
>>> problem) or should SCons itself add a rule when they are installed?
>>> I am guessing that a SCons mimetype would be "text/x-scons" is that
>>> correct? Or should they be identified only as python scripts?
>>>
>>> I saw there are rules for make and cmake so I thought that adding
>>> to shared-mime-info would be the way to go.
>>>
>>> Thank you
>>> Carnë
>>>
>>> [1] http://www.scons.org/
>>
>> Technically, they are just python scripts, but it's not my call to make,
>> so hopefully a senior dev will chime in :)
>>
>> SConstruct is a required name, but SConscript is not even though it may be
>> the standard/convention.  The subscripts can use any name you like
>> technically.  I usually include the "*.py" extension so that language
>> bindings in editors work without setting changes.
>>
>> V/R,
>> William
>
> What would be the benefit of doing such?
>

The system will identify a SConstruct file as such.  For example, using
`file` on a Makefile I get:

    $ file --mime Makefile
    Makefile: text/plain; charset=us-ascii

What you can do with this is up to you and your desktop.  The most simple
case is text editors being able to pick the correct syntax highlight.
At the moment I have a SConstruct file that is being identified as
Matlab script [1].  This is easy to fix on the shared-mime-info side.
I'd be happy if the file would at least be identified as Python but then I
wondered if it makes more sense to have its own mimetype (and subclass
python).

Actually, I do have my own scons syntax highlight for gtksourceview but
it only makes sense if a mimetype for it exists.

Carnë

[1] https://bugs.freedesktop.org/show_bug.cgi?id=87920


More information about the Scons-dev mailing list