SCons scripts (named SConscripts) and input files (name Sconstruct) are python scripts. However, they are incorrectly identified as Matlab scripts when they start with '##' (which is required to define enconding in python scripts). Example: ## coding: utf-8 import os env = Environment(ENV = os.environ) thesis = env.PDF(target = "thesis.pdf", source = "thesis.tex") This simple file is identified as Matlab but it is incorrect Matlab from the very first line ('#' is not a valid comment character in Matlab). Looking at the git logs, I found "a1f1b88f" which added the magic: <match type="string" value="##" offset="0"/> The log message mentions this is to identify Octave scripts as Matlab (I'll arguee this is also incorrect since such file would never run on Matlab, there should be a separate mime for Octave). I would suggest the following fixes: * add a 'SConscript' and 'SConstruct' magic for filenames to be identified as Python * add the Python magic coding comments as magic to identify Python. These are detailed on PEP 263 (https://www.python.org/dev/peps/pep-0263/) and pretty much are "coding=" or "coding:" in a comment on the first or second line of a file * remove '##' as magic for Matlab (have it as a separate one for Octave)
Created attachment 112613 [details] [review] adds new mimetype for scons As discussed on the xdg mailing list, I am adding a patch that creates a new mimetype for scons. It also adds 3 new test files.
commit 29c2eab964cfd8c45fd8a7f5d8407bbc94222095 Author: Carnë Draug <carandraug+dev@gmail.com> Date: Wed Jan 21 17:45:51 2015 +0000 New mimetype for SCons scripts as subclass of x-python. Scons is a build-system whose recipes/build rules are python scripts. As such its files are also valid python scripts (why it is subclassing x-python). The configuration files are pretty much always named "SConstruct". In addition, "SConscript" files can also exist to extend an existing SConstruct file. They can be named anything but by convention they are named SConscript or SConscript.build_name. https://bugs.freedesktop.org/show_bug.cgi?id=87920
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.