[Distutils] New PEP : dependency specification

Robert Collins robertc at robertcollins.net
Mon Nov 9 13:56:23 EST 2015


Pushed up this edit..

On 9 November 2015 at 18:45, Robert Collins <robertc at robertcollins.net> wrote:
> On 9 November 2015 at 17:55, Nathaniel Smith <njs at pobox.com> wrote:
>> The new version is looking pretty good to me!
>>
>> My main concern still is that specification of whitespace handling is
>> still kinda confusing/underspecified. The text says "all whitespace is
>> optional", but the grammar says that it's mandatory in some cases
>> (e.g. url-marker, still not sure why -- I'd understand if it were
>> mandatory before the ";" since ";" is a valid character in URLs, but
>> it says it's mandatory afterward?), and the grammar is still wrong
>> about whitespace in some cases (e.g. it says ">= 1.0" is an illegal
>> versionspec).
>>
>> I guess the two options are either to go through carefully sprinkling
>> *WSP's about at all the appropriate places, or else to tackle things
>> more systematically by adding a lexer layer...
>
> I'm happy either way. You are right though that there is one spot
> where it is not optional. Thats how "url; marker stuff here"  is
> defined in pip today. We could in principle define a new rule here,
> such as putting markers before the url. But as markers aren't self
> delimiting (blame PEP-345) that is a bit fugly. We could say 'url
> 1*WSP ";" *WSP marker', which would be a bit more consistent, but
> different to pip's current handling. Of course, the @ syntax is
> already different, so it seems reasonable to do so to me.

diff --git a/dependency-specification.rst b/dependency-specification.rst
index 9e95417..6afe288 100644
--- a/dependency-specification.rst
+++ b/dependency-specification.rst
@@ -84,8 +84,9 @@ URI is defined in std-66 [#std66]_::

     version-cmp   = "<" / "<=" / "!=" / "==" / ">=" / ">"
     version       = 1*( DIGIT / ALPHA / "-" / "_" / "." / "*" )
-    version-inner = version-cmp version *(',' version-cmp version)
-    versionspec   = ("(" version-inner ")") / version-inner
+    version-one   = *WSP version-cmp *WSP version
+    version-many  = version-one *(*WSP "," version-one)
+    versionspec   = ("(" version-many ")") / version-many
     urlspec       = "@" URI

 Environment markers allow making a specification only take effect in some
@@ -107,7 +108,7 @@ environments::
                   =/ (marker-var [*WSP marker-op *WSP marker-var])
     marker        = *WSP marker-expr *( *WSP ("and" / "or") *WSP marker-expr)
     name-marker   = ";" *WSP marker
-    url-marker    = ";" 1*WSP marker
+    url-marker    = WSP ";" *WSP marker

 Optional components of a distribution may be specified using the extras
 field::
@@ -131,7 +132,8 @@ Leading to the unified rule that can specify a dependency::
 Whitespace
 ----------

-Non line-breaking whitespace is optional and has no semantic meaning.
+Non line-breaking whitespace is mostly optional with no semantic meaning. The
+sole exception is detecting the end of a URL requirement.

 Names
 -----




-- 
Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud


More information about the Distutils-SIG mailing list