* [gentoo-portage-dev] [PATCH] repoman: Add file encoding sheband for py-2.7 compatibility
@ 2015-10-03 16:08 Brian Dolbec
2015-10-03 17:19 ` Zac Medico
0 siblings, 1 reply; 3+ messages in thread
From: Brian Dolbec @ 2015-10-03 16:08 UTC (permalink / raw
To: gentoo-portage-dev
From 841660a8064012b734b5c62e1c1e3e1132403d5c Mon Sep 17 00:00:00 2001
From: Brian Dolbec <dolsen@gentoo.org>
Date: Sat, 3 Oct 2015 08:57:55 -0700
Subject: [PATCH] repoman: Add file encoding sheband for py-2.7 compatibility
(bug 562108)
This makes python treat all string declarations as unicode strings.
This prevents errors like getting an unicode string via the command line and it being
added to an ascii string.
X-Gentoo-bug: 562108
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=562108
---
pym/repoman/_subprocess.py | 1 +
pym/repoman/_xml.py | 1 +
pym/repoman/actions.py | 1 +
pym/repoman/argparser.py | 1 +
pym/repoman/check_missingslot.py | 1 +
pym/repoman/checks/directories/files.py | 1 +
pym/repoman/checks/ebuilds/checks.py | 1 +
pym/repoman/checks/ebuilds/errors.py | 1 +
pym/repoman/checks/ebuilds/fetches.py | 1 +
pym/repoman/checks/ebuilds/isebuild.py | 1 +
pym/repoman/checks/ebuilds/keywords.py | 1 +
pym/repoman/checks/ebuilds/manifests.py | 1 +
pym/repoman/checks/ebuilds/misc.py | 1 +
pym/repoman/checks/ebuilds/pkgmetadata.py | 1 +
pym/repoman/checks/ebuilds/thirdpartymirrors.py | 1 +
pym/repoman/checks/ebuilds/use_flags.py | 1 +
pym/repoman/checks/herds/metadata.py | 1 +
pym/repoman/copyrights.py | 1 +
pym/repoman/ebuild.py | 1 +
pym/repoman/errors.py | 1 +
pym/repoman/gpg.py | 1 +
pym/repoman/main.py | 1 +
pym/repoman/metadata.py | 1 +
pym/repoman/modules/commit/repochecks.py | 1 +
pym/repoman/profile.py | 1 +
pym/repoman/qa_data.py | 1 +
pym/repoman/repos.py | 1 +
pym/repoman/scan.py | 1 +
pym/repoman/scanner.py | 1 +
pym/repoman/utilities.py | 1 +
pym/repoman/vcs/vcs.py | 1 +
pym/repoman/vcs/vcsstatus.py | 1 +
32 files changed, 32 insertions(+)
diff --git a/pym/repoman/_subprocess.py b/pym/repoman/_subprocess.py
index 5449e64..dcdc985 100644
--- a/pym/repoman/_subprocess.py
+++ b/pym/repoman/_subprocess.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
import codecs
diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index 7bf6698..0acda28 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
import sys
import xml
diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 0806cb5..f461703 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
from __future__ import print_function, unicode_literals
diff --git a/pym/repoman/argparser.py b/pym/repoman/argparser.py
index 1c9bd45..85e261d 100644
--- a/pym/repoman/argparser.py
+++ b/pym/repoman/argparser.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
# repoman: Argument parser
# Copyright 2007-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
diff --git a/pym/repoman/check_missingslot.py b/pym/repoman/check_missingslot.py
index 3f79435..4a3c57b 100644
--- a/pym/repoman/check_missingslot.py
+++ b/pym/repoman/check_missingslot.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
# repoman: missing slot check
# Copyright 2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py
index b1d77df..9bb560c 100644
--- a/pym/repoman/checks/directories/files.py
+++ b/pym/repoman/checks/directories/files.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
'''repoman/checks/diretories/files.py
diff --git a/pym/repoman/checks/ebuilds/checks.py b/pym/repoman/checks/ebuilds/checks.py
index 5ebc6c1..245ab2b 100644
--- a/pym/repoman/checks/ebuilds/checks.py
+++ b/pym/repoman/checks/ebuilds/checks.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
# repoman: Checks
# Copyright 2007-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
diff --git a/pym/repoman/checks/ebuilds/errors.py b/pym/repoman/checks/ebuilds/errors.py
index d5c8d2e..3090de0 100644
--- a/pym/repoman/checks/ebuilds/errors.py
+++ b/pym/repoman/checks/ebuilds/errors.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
# repoman: Error Messages
# Copyright 2007-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
diff --git a/pym/repoman/checks/ebuilds/fetches.py b/pym/repoman/checks/ebuilds/fetches.py
index 077340d..32da21a 100644
--- a/pym/repoman/checks/ebuilds/fetches.py
+++ b/pym/repoman/checks/ebuilds/fetches.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
'''fetches.py
Performs the src_uri fetchlist and files checks
diff --git a/pym/repoman/checks/ebuilds/isebuild.py b/pym/repoman/checks/ebuilds/isebuild.py
index f0c9a48..3992c9c 100644
--- a/pym/repoman/checks/ebuilds/isebuild.py
+++ b/pym/repoman/checks/ebuilds/isebuild.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
import stat
diff --git a/pym/repoman/checks/ebuilds/keywords.py b/pym/repoman/checks/ebuilds/keywords.py
index 235c751..9d2585e 100644
--- a/pym/repoman/checks/ebuilds/keywords.py
+++ b/pym/repoman/checks/ebuilds/keywords.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
'''keywords.py
Perform KEYWORDS related checks
diff --git a/pym/repoman/checks/ebuilds/manifests.py b/pym/repoman/checks/ebuilds/manifests.py
index 3b8dec5..1ca4f94 100644
--- a/pym/repoman/checks/ebuilds/manifests.py
+++ b/pym/repoman/checks/ebuilds/manifests.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
import logging
import sys
diff --git a/pym/repoman/checks/ebuilds/misc.py b/pym/repoman/checks/ebuilds/misc.py
index d735542..e2bef34 100644
--- a/pym/repoman/checks/ebuilds/misc.py
+++ b/pym/repoman/checks/ebuilds/misc.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
'''repoman/checks/ebuilds/misc.py
Miscelaneous ebuild check functions'''
diff --git a/pym/repoman/checks/ebuilds/pkgmetadata.py b/pym/repoman/checks/ebuilds/pkgmetadata.py
index 8dc3f60..f22ef19 100644
--- a/pym/repoman/checks/ebuilds/pkgmetadata.py
+++ b/pym/repoman/checks/ebuilds/pkgmetadata.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
'''Package Metadata Checks operations'''
diff --git a/pym/repoman/checks/ebuilds/thirdpartymirrors.py b/pym/repoman/checks/ebuilds/thirdpartymirrors.py
index 061e71f..848dfb9 100644
--- a/pym/repoman/checks/ebuilds/thirdpartymirrors.py
+++ b/pym/repoman/checks/ebuilds/thirdpartymirrors.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
# import our initialized portage instance
from repoman._portage import portage
diff --git a/pym/repoman/checks/ebuilds/use_flags.py b/pym/repoman/checks/ebuilds/use_flags.py
index 73680d0..ac21b47 100644
--- a/pym/repoman/checks/ebuilds/use_flags.py
+++ b/pym/repoman/checks/ebuilds/use_flags.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
'''use_flags.py
Performs USE flag related checks
diff --git a/pym/repoman/checks/herds/metadata.py b/pym/repoman/checks/herds/metadata.py
index 3c67fcf..b4a433e 100644
--- a/pym/repoman/checks/herds/metadata.py
+++ b/pym/repoman/checks/herds/metadata.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
class UnknownHerdsError(ValueError):
diff --git a/pym/repoman/copyrights.py b/pym/repoman/copyrights.py
index 056cfda..761309a 100644
--- a/pym/repoman/copyrights.py
+++ b/pym/repoman/copyrights.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
import difflib
diff --git a/pym/repoman/ebuild.py b/pym/repoman/ebuild.py
index 1dddfb9..fdfb083 100644
--- a/pym/repoman/ebuild.py
+++ b/pym/repoman/ebuild.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
from portage import os
diff --git a/pym/repoman/errors.py b/pym/repoman/errors.py
index 305eece..2ea4680 100644
--- a/pym/repoman/errors.py
+++ b/pym/repoman/errors.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
import sys
diff --git a/pym/repoman/gpg.py b/pym/repoman/gpg.py
index 90fe749..26e2432 100644
--- a/pym/repoman/gpg.py
+++ b/pym/repoman/gpg.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
from __future__ import print_function, unicode_literals
diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e232558..00d48e7 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -1,4 +1,5 @@
#!/usr/bin/python -bO
+# -*- coding:utf-8 -*-
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f2b63a7..70c07a8 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
import errno
import logging
diff --git a/pym/repoman/modules/commit/repochecks.py b/pym/repoman/modules/commit/repochecks.py
index 8019e28..163466d 100644
--- a/pym/repoman/modules/commit/repochecks.py
+++ b/pym/repoman/modules/commit/repochecks.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
from __future__ import print_function, unicode_literals
diff --git a/pym/repoman/profile.py b/pym/repoman/profile.py
index 3634fb9..50da917 100644
--- a/pym/repoman/profile.py
+++ b/pym/repoman/profile.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
from __future__ import print_function, unicode_literals
diff --git a/pym/repoman/qa_data.py b/pym/repoman/qa_data.py
index b26559c..dddfb98 100644
--- a/pym/repoman/qa_data.py
+++ b/pym/repoman/qa_data.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
import logging
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index 72e5735..9a62e05 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
import io
diff --git a/pym/repoman/scan.py b/pym/repoman/scan.py
index fef6d82..28dfa15 100644
--- a/pym/repoman/scan.py
+++ b/pym/repoman/scan.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
import logging
import os
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 1e1a38e..ff32ac8 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
from __future__ import print_function, unicode_literals
diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 2a1f4d9..47b5aab 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
# repoman: Utilities
# Copyright 2007-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
diff --git a/pym/repoman/vcs/vcs.py b/pym/repoman/vcs/vcs.py
index 9b77e8e..49d3058 100644
--- a/pym/repoman/vcs/vcs.py
+++ b/pym/repoman/vcs/vcs.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
from __future__ import print_function, unicode_literals
diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py
index 30e00ad..4dc633e 100644
--- a/pym/repoman/vcs/vcsstatus.py
+++ b/pym/repoman/vcs/vcsstatus.py
@@ -1,3 +1,4 @@
+# -*- coding:utf-8 -*-
# import our initialized portage instance
--
2.5.3
--
Brian Dolbec <dolsen>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] repoman: Add file encoding sheband for py-2.7 compatibility
2015-10-03 16:08 [gentoo-portage-dev] [PATCH] repoman: Add file encoding sheband for py-2.7 compatibility Brian Dolbec
@ 2015-10-03 17:19 ` Zac Medico
2015-10-03 17:36 ` Brian Dolbec
0 siblings, 1 reply; 3+ messages in thread
From: Zac Medico @ 2015-10-03 17:19 UTC (permalink / raw
To: gentoo-portage-dev
On 10/03/2015 09:08 AM, Brian Dolbec wrote:
> From 841660a8064012b734b5c62e1c1e3e1132403d5c Mon Sep 17 00:00:00 2001
> From: Brian Dolbec <dolsen@gentoo.org>
> Date: Sat, 3 Oct 2015 08:57:55 -0700
> Subject: [PATCH] repoman: Add file encoding sheband for py-2.7 compatibility
> (bug 562108)
>
> This makes python treat all string declarations as unicode strings.
> This prevents errors like getting an unicode string via the command line and it being
> added to an ascii string.
>
> X-Gentoo-bug: 562108
> X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=562108
> ---
I don't have anything against adding these unicode shebangs, but they
won't fix the problem, because they only change the interpreted encoding
of literals embedded in python files. Under python2, that means the
literals are still plain bytes, just with a different encoding. You have
to use 'from __future__ import unicode_literals' if you really want
string literals to behave as unicode strings.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] repoman: Add file encoding sheband for py-2.7 compatibility
2015-10-03 17:19 ` Zac Medico
@ 2015-10-03 17:36 ` Brian Dolbec
0 siblings, 0 replies; 3+ messages in thread
From: Brian Dolbec @ 2015-10-03 17:36 UTC (permalink / raw
To: gentoo-portage-dev
On Sat, 3 Oct 2015 10:19:41 -0700
Zac Medico <zmedico@gentoo.org> wrote:
> On 10/03/2015 09:08 AM, Brian Dolbec wrote:
> > From 841660a8064012b734b5c62e1c1e3e1132403d5c Mon Sep 17 00:00:00
> > 2001 From: Brian Dolbec <dolsen@gentoo.org>
> > Date: Sat, 3 Oct 2015 08:57:55 -0700
> > Subject: [PATCH] repoman: Add file encoding sheband for py-2.7
> > compatibility (bug 562108)
> >
> > This makes python treat all string declarations as unicode strings.
> > This prevents errors like getting an unicode string via the command
> > line and it being added to an ascii string.
> >
> > X-Gentoo-bug: 562108
> > X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=562108
> > ---
>
> I don't have anything against adding these unicode shebangs, but they
> won't fix the problem, because they only change the interpreted
> encoding of literals embedded in python files. Under python2, that
> means the literals are still plain bytes, just with a different
> encoding. You have to use 'from __future__ import unicode_literals'
> if you really want string literals to behave as unicode strings.
Yes, all files that used any print() already imported both
print_function and unicode_literals.
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-03 17:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-03 16:08 [gentoo-portage-dev] [PATCH] repoman: Add file encoding sheband for py-2.7 compatibility Brian Dolbec
2015-10-03 17:19 ` Zac Medico
2015-10-03 17:36 ` Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox