Dired ignore directory local mode value - emacs

How can I have dired ignore any directory local value set for mode? It I set a mode in a .dir-locals.el file, the variables apply to dired as well, causing it to fail.
For example, with a directory structure as
$ tree -a
.
├── config.d
│   ├── 010-github
│   └── 020-mail
└── .dir-locals.el
And in the dir-locals
(("config.d"
. ((nil . ((mode . ssh-config))))))
If I try to dired-find-file on config.d, I get an error. How can I tell dired to ignore a mode value in the dir-local-variables-alist?

Related

Pytest set default path/directory/fodler as project directory (solve FileNotFoundError)

I have the next tree:
root_project/
├── app
│   ├── default_photo_profile.jpg
│   ├── config.py
│   ├── __main__.py # My app are python package, I'm runnig it via "python -m"
│   └── ...
├── tests
│   ├── test_unit.py # import config.py inside
│   ├── functional # import config.py inside
│   ├── pytest.ini
│   └── ...
...
Currently default_photo_profile causing error because tests doesn't have this file.
Reading file in config.py:
DEFAULT_PHOTO_FILE_PATH = Path('default_photo.jpg')
with open(file=DEFAULT_PHOTO_FILE_PATH, mode='rb') as file_obj:
DEFAULT_PHOTO_BYTES = file_obj.read()
How I can solve this?
I tried:
Patch access to default_photo.jpg with fixture - not helped, error during import stage, not executiion.
set flag to pytest comamnd line: --rootdir app - not helped (don't know why).
try/except for reading the file in app.config.py - may help but it's not my intention, I really want raise error if file not found
Put default_photo.jpg inside EVERY test directory - will help bit dirty.
Patch os.path like suggested in https://stackoverflow.com/a/43003192/11277611 - dirty
Include tests into package (move __main__.py into root_project - not sure that it's a good idea (have not enough experience to decide).
Set absolut path to default_photo.jpg - will fail on the production server.
Probably adoptable solutions (What I want):
Set root dir to root_project.app somehow inside pytest.ini to immitate regular execution.
Set root dir to root_project.tests somehow to place file in root of tests and access from any of tests folder.
Try to use following code in config.py:
DEFAULT_PHOTO_FILE_PATH = Path(__file__).parent / 'default_photo.jpg'
with open(file=DEFAULT_PHOTO_FILE_PATH, mode='rb') as file_obj:
DEFAULT_PHOTO_BYTES = file_obj.read()
Is it what you are trying to achieve?

Import File Mismatch in pytest with same test names

This is a much asked question, but none of the solutions mentioned on SO have worked so far.
The folder structure is as follows:
project/
└── tests/
├── conftest.py
├── __init__.py
└── int_tests/
└── test_device.py
└── project_core/
└── tests/
├── conftest.py
├── __init__.py
└── int_tests/
└── test_device.py
import file mismatch:
imported module 'test_device' has this __file__ attribute:
/home/.../project/project_core/tests/int_tests/test_device.py
which is not the same as the test file we want to collect:
/home/.../project/tests/int_tests/test_device.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
Steps tried so far:
Removing pycache and pyc files.
Adding _init to each folder. (As is stated in pytest GIP)
Removing _init from each folder.
Do i need init files in each tests/subfolder?
The same error occurs with conftest.py as well. This error is not limited to vscode-pytest plugin, also occurs on the terminal.
PS : For CI purposes, the system is configured with docker & tox. Development is done in venv.

How to provide the U-Boot default environment from a file in Yocto?

I want to avoid setting the default environment in CONFIG_EXTRA_ENV_SETTINGS, therefore I've set CONFIG_DEFAULT_ENV_FILE="uEnv.txt" and created that text file but bitbake doesn't find it:
make[1]: *** No rule to make target 'uEnv.txt', needed by 'include/generated/defaultenv_autogenerated.h'. Stop.
This is what the tree and the files look like:
└── u-boot
├── files
│   ├── ma1.cfg
│   └── uEnv.txt
└── u-boot-xlnx_%.bbappend
ma1.cfg:
CONFIG_USE_DEFAULT_ENV_FILE=y
CONFIG_DEFAULT_ENV_FILE="uEnv.txt"
u-boot-xlnx_%.bbappend:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append_tmc = " \
file://ma1.cfg \
file://uEnv.txt \
"
PACKAGE_BEFORE_PN += "${PN}-env"
RPROVIDES_${PN}-env += "u-boot-default-env"
I don't know where to put the uEnv.txt so it will be found. I already (blindly) tried to specify some different paths like CONFIG_DEFAULT_ENV_FILE="../uEnv.txt" but to no avail. I suspect that I need to put it somewhere in a do_configure_append() but I don't know where.
Searching for CONFIG_DEFAULT_ENV_FILE only yields results which state that it can be used to create the environment from a file[1], but unfortunately not how. Or, more precisely: How to use it with bitbake.
So I hope someone can help me here: What do I need to do so bitbake places the text file where make is going to find it?
[1] https://lists.denx.de/pipermail/u-boot/2018-March/323347.html
You need to pass your uEnv.txt file to the build directory to be found by Make.
You can do this in your bbappend file like:
do_configure_append() {
cp ${WORKDIR}/uEnv.txt ${S}
}

Tree-like layouts in Org-Mode

Say I want to enter information in an Org file that could be displayed in a tree-like format. Can Org help me with this?
For example I want Org to display a hierarchy of entities as follows:
ROOT
├── foo
│   └── bar
├── baz
├── bax
├── src
│   ├── main
│   │   ├── java
│   │   │   └── something
│   │   └── fine
│   ├── yes
│   └── no
How can I enter this information in a way that Org understands it so that it can render the tree as above?
You might be interested by ditaa block for this:
#+name: tree
#+begin_src ditaa
ROOT
|
+--foo
| +----bar
|
+--baz
+--bax
+--src
| +--main
| | +---java
| | | +---something
| | |
| | +---fine
| |
| +--yes
| +--no
#+end_src
typing C-c ` in the src block will put you in artist-mode, a mode made for editing ascii art and that should make editing those tree easier.
Assuming ROOT is a title that you would want displayed, you can do something like
* ROOT
** foo
*** bar
** baz
** bax
** src
*** main
**** java
***** something
**** fine
*** yes
*** no
The empty lines are optional. I just use them for readability.
If you only want to use one asterisk per level, checkout this link which explains how you can modify org-mode to use indentation and a single asterisk.
If the directory already exists you can use tree, as explained here. I've tried both and had issue with executing ditaa sometimes (emacs couln't find the ditaa.jar in some installations). Furthermore, ditaa output is an image, but the output of tree is text. You can use a src_block like this:
#+BEGIN_SRC sh :results output :exports results
tree /path/to/dir
#+END_SRC

Why is Compass is giving me an import error when trying to import partials

My compass project directory structure looks like this
s3z#s3z:~/Desktop/compass_project$ tree
.
├── basic.html
├── config.rb
├── css
│   ├── ie.css
│   ├── print.css
│   └── screen.css
├── index.html
├── partials
│   └── _normalize.scss
└── sass
├── ie.scss
├── print.scss
└── screen.scss
My screen.scss file looks like this
#import "compass";
#import "partials/normalize";
When I add #import "partials/normalize"; and save it, Compass spits the following error back at me
>>> Compass is watching for changes. Press Ctrl-C to Stop.
>>> Change detected at 22:58:53 to: screen.scss
error sass/screen.scss (Line 2: File to import not found or unreadable: partials/normalize.
Load paths:
/home/max/Desktop/nettut_compass_tut/sass
/home/max/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/blueprint/stylesheets
/home/max/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets
Compass::SpriteImporter)
overwrite ./css/screen.css
And just in case it matters my config.rb is
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
Any ideas on how to fix this?
You've defined your sass_dir as sass so compass is looking for that reset file in: sass/partials/normalize If you want to import something outside of your sass_dir, you need to use a path relative to the sass file that's doing the importing:
#import "../partials/normalize";
personally, I prefer to put the partial directory in the sass directory, or just let them sort to the top loose.