Having trouble exiting pyenv-virtualenv on macOS - pyenv

I'm using pyenv-virtualenv, but when I run deactivate or source deactivate, I remain in the virtual environment.
(env1) sashamarinskiy#Sashas-MacBook-Air ~ % deactivate
pyenv-virtualenv: deactivate must be sourced. Run 'source deactivate' instead of 'deactivate'
(env1) sashamarinskiy#Sashas-MacBook-Air ~ % source deactivate
pyenv-virtualenv: deactivate 3.10.6/envs/env1
(env1) sashamarinskiy#Sashas-MacBook-Air ~ % echo $VIRTUAL_ENV
/Users/sashamarinskiy/.pyenv/versions/3.10.6/envs/env1
(env1) sashamarinskiy#Sashas-MacBook-Air ~ %

Related

vim:how to autocompile c file in the floaterm

I am using floaterm, which is a vim plugin. It is shown in the link. I want to set <F5> as the key to compile c file in the floaterm. And this is the setting:
noremap <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
FloatermNew gcc -ansi -Wall % -o %< && time ./%<
endif
endfunc
The :FloatermNew is the one of the options to open floaterm.
When I press <F5>, it does compile in the floaterm, but the floaterm disappears a moment later. So I want to know how to let it compile and the floaterm is still there to show me the output.

How to get release notes from Semantic Release output using grep command

I am trying to automate the release of software using semantic-release. Everything is working fine. I run this command npx semantic-release --no-ci --dry-run and get the following output in the terminal
...some other output
[1:01:55 pm] [semantic-release] › ⚠ Skip v0.1.1 tag creation in dry-run mode
[1:01:55 pm] [semantic-release] › ✔ Published release 0.1.1 on default channel
[1:01:55 pm] [semantic-release] › ℹ Release note for version 0.1.1:
## 0.1.1 (2021-01-24)
### Bug Fixes
* ravgeet is fixing things (92797f6)
* removed unwanted files (bdcc9ff)
* this is another fix (dbef2fd)
Now I need to get the release notes from the output
## 0.1.1 (2021-01-24)
### Bug Fixes
* ravgeet is fixing things (92797f6)
* removed unwanted files (bdcc9ff)
* this is another fix (dbef2fd)
How can I do so using grep command or any other means?
With GNU sed.
| sed -n '/^##/,$p'
-n: Do not output anything unless it is explicitly stated (here with command p)
x,yp: You can replace x and y with a regex (here: /^##/), a line number or a special character like $. $ matches here last line in input.
/^##/: regex for lines starting with two #
p output sed's pattern space (current line).
| sed '/^##/,$!d'is a more compact notation. I translate !d with don't delete.
See: man sed and The Stack Overflow Regular Expressions FAQ

How to update modules.conf for SELINUX in BUILDROOT?

looking to disable some SELinux modules (set to off) and create others in modules.conf. I don't see an obvious way of updating modules.conf as I tried adding my changes as a modules.conf patch but it failed given that the modules.conf file gets built and is not just downloaded by BR so it is not available for patching like other things under the refpolicy directory:
Build window output:
refpolicy 2.20190609 PatchingApplying 0001-refpolicy-update-modules-conf.patch using patch:
can't find file to patch at input line 3
I did see in the log that there is a support/sedoctool.py that autogenerates the policy/modules.conf file so that the file is NOT patchable like most other things in the ref policy.
The relevant section of the buildroot/output/build/refpolicy-2.20190609/Makefile:
# policy building support tools
support := support
genxml := $(PYTHON) $(support)/segenxml.py
gendoc := $(PYTHON) $(support)/sedoctool.py
<...snip...>
########################################
#
# Create config files
#
conf: $(mod_conf) $(booleans) generate$(booleans) $(mod_conf): conf.intermediate.INTERMEDIATE: conf.intermediate
conf.intermediate: $(polxml)
#echo "Updating $(booleans) and $(mod_conf)"
$(verbose) $(gendoc) -b $(booleans) -m $(mod_conf) -x $(polxml)
Part of the hsmlinux build.log showing the sedoctool.py (gendoc) being run:
Updating policy/booleans.conf and policy/modules.conf
.../build-buildroot-sawshark/buildroot/output/host/usr/bin/python3 support/sedoctool.py -b policy/booleans.conf -m policy/modules.conf -x doc/policy.xml
I'm sure there is a standard way of doing this, just doesn't seem to be documented anywhere I can find.
Thanks.
Turns out that the sedoctool.py script is reading the doc/policy.xml. Looking at sedoctool.py:
#modules enabled and disabled values
MOD_BASE = "base"
MOD_ENABLED = "module"
MOD_DISABLED = "off"
<...snip...>
def gen_module_conf(doc, file_name, namevalue_list):
"""
Generates the module configuration file using the XML provided and the
previous module configuration.
"""
# If file exists, preserve settings and modify if needed.
# Otherwise, create it.
<...snip...>
mod_name = node.getAttribute("name")
mod_layer = node.parentNode.getAttribute("name")
<...snip...>
if mod_name and mod_layer:
file_name.write("# Layer: %s\n# Module: %s\n" % (mod_layer,mod_name))
if required:
file_name.write("# Required in base\n")
file_name.write("#\n")
if [mod_name, MOD_DISABLED] in namevalue_list:
file_name.write("%s = %s\n\n" % (mod_name, MOD_DISABLED))
# If the module is set as enabled.
elif [mod_name, MOD_ENABLED] in namevalue_list:
file_name.write("%s = %s\n\n" % (mod_name, MOD_ENABLED))
# If the module is set as base.
elif [mod_name, MOD_BASE] in namevalue_list:
file_name.write("%s = %s\n\n" % (mod_name, MOD_BASE))
So sedoctool.py has the nice feature of: "# If file exists, preserve settings and modify if needed." and modules.conf can just be added whole here via a complete file patch and the modules that are not desired set as "off" : refpolicy-2.20190609/policy/modules.conf and the script will update as needed based on desired policy.
One more detail is that in the next stage of the refpolicy Makefile (Building) the modules.conf with the updates is deleted in the beginning which kind of clashes with the ability of sedoctool to preserve the patched version of modules.conf...so patched the removal in the Building stage of the Makefile.
[7m>>> refpolicy 2.20190609 Building^[
<...snip...>
rm -f policy/modules.conf
The Makefile in refpolicy-2.20190609 has this line that I patched out because we are patching in our own modules.conf:
bare: clean
<...snip...>
$(verbose) rm -f $(mod_conf)
That patch looks like:
--- BUILDROOT/Makefile 2020-08-17 13:25:06.963804709 -0400
+++ FIX/Makefile 2020-08-17 19:25:29.540607763 -0400
## -636,7 +636,6 ##
$(verbose) rm -f $(modxml)
$(verbose) rm -f $(tunxml)
$(verbose) rm -f $(boolxml)
- $(verbose) rm -f $(mod_conf)
$(verbose) rm -f $(booleans)
$(verbose) rm -fR $(htmldir)
$(verbose) rm -f $(tags)
BTW,
Creating a patch with a complete new file in pp1:q!:
diff -crB --new-file pp0 pp1 > pp0.patch

How to remove blank line before prompt when I set fish_greating to null?

I want to remove the blank line before prompt when I open a new fish shell window.
I try to remove fish_greating use official FAQ.
➜ set fish_greeting
Here's my plugins.
vue-multiple-pages on  master [!] is 📦 v0.1.0 via ⬢ none
➜ fisher ls
edc/bass
FabioAntunes/fish-nvm
matchai/spacefish
It works. I remove the greating "Welcome to fish, the friendly interactive shell".
But, I got a blank line like this:
How to remove this blank line?
======updated======
This is is gif that I want to explain.
Thanks.
After a few hours of hard work, I found the answer.
It's the matchai/spacefish plugin which add new line to my prompt.
Here is the function
# Defined in /Users/liwei/.config/fish/functions/fish_prompt.fish # line 1
function fish_prompt
set -g sf_exit_code $status
set -g SPACEFISH_VERSION 2.6.0
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_PROMPT_ADD_NEWLINE true
__sf_util_set_default SPACEFISH_PROMPT_FIRST_PREFIX_SHOW false
__sf_util_set_default SPACEFISH_PROMPT_PREFIXES_SHOW true
__sf_util_set_default SPACEFISH_PROMPT_SUFFIXES_SHOW true
__sf_util_set_default SPACEFISH_PROMPT_DEFAULT_PREFIX "via "
__sf_util_set_default SPACEFISH_PROMPT_DEFAULT_SUFFIX " "
__sf_util_set_default SPACEFISH_PROMPT_ORDER time user dir host git package node ruby golang php rust haskell julia elixir docker aws venv conda pyenv dotnet kubecontext exec_time line_sep battery vi_mode jobs exit_code char
# ------------------------------------------------------------------------------
# Sections
# ------------------------------------------------------------------------------
# Keep track of whether the prompt has already been opened
set -g sf_prompt_opened $SPACEFISH_PROMPT_FIRST_PREFIX_SHOW
if test "$SPACEFISH_PROMPT_ADD_NEWLINE" = "true"
echo
end
for i in $SPACEFISH_PROMPT_ORDER
eval __sf_section_$i
end
set_color normal
end
Just set SPACEFISH_PROMPT_ADD_NEWLINE to false,
add this line to your config.fish and solve the problem.
set SPACEFISH_PROMPT_ADD_NEWLINE false
Thanks to all.

Buildroot Config Option for applying custom patch

I am new to buildroot and working to build Linaro with buildroot ..I have multiple fragment kernel config files and specified that in buildroot defconfig.
I have specified a custom kernel patches directory with BR2_LINUX_PATCH_DIR .
I dont have some of the config flags not set which are supposed to be there in the .config files..so i suspect that the Patches are applied successfully..so i tried giving a non existing location as Linux Patch dir and it does not give any error..
Is there anything other than giving value to BR2_LINUX_PATCH_DIR and what should be the format of the dir structure...in buildroot manual it says it should be
Package_name/patch name..For linux what should be the package name? It should be the same with which linux dir is created.for example for me it is linux-custom
Plz suggest and guide me in this.
Thanks in Advance
The option is named BR2_LINUX_KERNEL_PATCH, there is nothing named BR2_LINUX_PATCH_DIR. It applies all patches listed in this option (if those are files), or all files named *.patch if what's given in this option is a directory. See the code in linux/linux.mk:
define LINUX_APPLY_LOCAL_PATCHES
for p in $(filter-out ftp://% http://% https://%,$(LINUX_PATCHES)) ; do \
if test -d $$p ; then \
$(APPLY_PATCHES) $(#D) $$p \*.patch || exit 1 ; \
else \
$(APPLY_PATCHES) $(#D) `dirname $$p` `basename $$p` || exit 1; \
fi \
done
endef
Also, I would recommend that you watch the output of Buildroot: it shows everything it is doing, especially it lists the patches it applied. Look at the line >>> linux .... Patching, which is the marker for the beginning of the patching step of the linux package.