public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: "Kévin Le Gouguec" <legouguec@adacore.com>
Cc: Simon Marchi <simark@simark.ca>, Tom Tromey <tom@tromey.com>,
	Tom Tromey <tromey@adacore.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH] Add flake8 and isort to .pre-commit-config.yaml
Date: Tue, 9 Apr 2024 14:56:13 +0200	[thread overview]
Message-ID: <ec8edb49-8590-4191-b02b-5317b91f2274@suse.de> (raw)
In-Reply-To: <874jcaq3ew.fsf@adacore.com>

On 4/9/24 11:41, Kévin Le Gouguec wrote:
> Tom de Vries <tdevries@suse.de> writes:
> 
>> just to report back on this with my current state.
>>
>> I use openleap 15.4 with python 3.6, and the used version of flake8 requires python 3.7, so I ran into trouble after this commit.
>>
>> Then I learned about "git commit -n", and started using that as workaround, but eventually ran into trouble because that doesn't seem to work while rebasing.
>>
>> I then decided to install python 3.11 and use a virtual environment, and use git commit from within that environment.  AFAICT, the virtual environment works as expected:
>> ...
>> $ python --version
>> Python 3.11.5
>> $ python3 --version
>> Python 3.11.5
>> ...
>> but for some reason I keep getting:
>> ...
>>        SyntaxError: future feature annotations is not defined
>> ...
>> which is the same error I got with python 3.6.
>>
>> I've tried removing ~/.cache/pre-commit a couple of times, but that didn't help either.
>>
>> So, atm I can no longer rebase.  I'll try to workaround this by adding a local commit that reverts this change, or something similar, but if anybody has another idea I'd be happy to hear it.
> 
> Hunch: have you installed pre-commit in this virtual environment, or are
> you using a pre-commit that comes from "outside", e.g. your distro, or
> 'pip install --user' before activating the venv?  FWIW this might yield
> clues:
> 
> $ head -1 $(which pre-commit)
> 

Hi Kevin,

thanks for the reaction.

The command you mention showed the correct pre-commit version.

But when running git commit, the wrong one was used.  I just needed to 
rerun "pre-commit install" to re-install the hooks, which fixes this.

I'll update the wiki entry to clarify this.

Thanks,
- Tom

> Over here this shows a shebang that points to […VENV…]/bin/python3
> (which in turn is a symlink to my system Python).
> 
> I would hope that 'pip install pre-commit' within your virtual
> environment would install a pre-commit that will use "the right Python",
> but I could be missing something.


  reply	other threads:[~2024-04-09 12:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 18:11 Tom Tromey
2024-04-02 20:26 ` Simon Marchi
2024-04-03 19:52   ` Tom Tromey
2024-04-03 19:57     ` Simon Marchi
2024-04-09  7:58       ` Tom de Vries
2024-04-09  9:41         ` Kévin Le Gouguec
2024-04-09 12:56           ` Tom de Vries [this message]
2024-04-09 13:04             ` Kévin Le Gouguec
2024-04-09 15:22         ` Tom Tromey
2024-04-10  5:38           ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ec8edb49-8590-4191-b02b-5317b91f2274@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=legouguec@adacore.com \
    --cc=simark@simark.ca \
    --cc=tom@tromey.com \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).