Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread Igor Gnatenko
Merged #1015 into master.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#event-3220830516___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread Gordon Messmer
Squashed.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-611878617___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread Igor Gnatenko
Please squash commits and I'll merge it

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-611872077___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread Igor Gnatenko
@ignatenkobrain approved this pull request.





-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#pullrequestreview-391260827___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread Gordon Messmer
I removed one more instance of stripping ".0" that doesn't have an effect on 
the output.  This one when printing provides.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-611849276___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread Gordon Messmer
@gordonmessmer pushed 1 commit.

e95e3bc68257d81cc5122079de308e6a96ba4bf9  Leave trailing .0 in the version 
until the convert function is called.


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015/files/6da249c4ca8731e5b9f7722924b855500798c2b2..e95e3bc68257d81cc5122079de308e6a96ba4bf9
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread torsava
@torsava approved this pull request.

Code looks good, tests are passing.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#pullrequestreview-391203820___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread torsava
> I've pushed a change that should resolve the issues with trailing .0 versions.

And now all tests pass! +1

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-611808976___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread Gordon Messmer
I've pushed a change that should resolve the issues with trailing .0 versions.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-611775730___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread Gordon Messmer
@gordonmessmer pushed 1 commit.

6da249c4ca8731e5b9f7722924b855500798c2b2  Leave trailing .0 in the version 
until the convert function is called.


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015/files/dfd7ba39bf94b56dd235c24a7a8a0c4b6d148bb7..6da249c4ca8731e5b9f7722924b855500798c2b2
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread torsava
@gordonmessmer As for my tests, I'm preparing a few changes to 
pythondistdeps.py, so I've added tests as well. The PR is still WIP.

https://github.com/torsava/rpm/pull/1

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-611623657___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread torsava
> This change incorporates code from 
> https://github.com/gordonmessmer/pyreq2rpm/ which has a test suite of its own.

That's exactly where I took my test data. I have tested your PR and 84 out of 
86 tests passed! These are the only 2 issues:

1. Input: foobar4~=2.0
Expected output: (python3.7dist(foobar4) >= 2 with python3.7dist(foobar4) < 
3)
Actual output: Invalid requirement: python3.7dist(foobar4) ~= 2
 [crashes pythondistdeps]

2. Input: foobar1~=2.4.8.0
Expected output: (python3.7dist(foobar1) >= 2.4.8 with 
python3.7dist(foobar1) < 2.4.9)
Actual output: (python3.7dist(foobar1) >= 2.4.8 with python3.7dist(foobar1) 
< 2.5)

However, you did not introduce these issues, the improper handling of a 
trailing ".0" in some cases was already present in the original version.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-611614414___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread Gordon Messmer
I'd be happy to help fill those tests out.  @torsava let me know where your 
work is at now, if you'd like.

This change incorporates code from https://github.com/gordonmessmer/pyreq2rpm/ 
which has a test suite of its own.  

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-611565741___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread torsava
> It would be nice to have the tests for these... But from the first glance 
> this looks good to me.

I'm actually writing a test suite for `scripts/pythondistdeps`, I'll report 
soon with the results.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-611481865___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread Igor Gnatenko
It would be nice to have the tests for these... But from the first glance this 
looks good to me.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-611392744___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-04-09 Thread Gordon Messmer
Please let me know if this PR needs any additional changes.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-611381277___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-03-23 Thread Gordon Messmer
Rebased.  Probably ought to have done that regardless.  :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-602657283___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-03-23 Thread Panu Matilainen
It's failing in CI due to the following warning/error:

> macro.c: In function 'doFoo':
macro.c:1211:2: error: 'sprintf' argument 3 may overlap destination object 
'buf' [-Werror=restrict]
 1211 |  sprintf(b, "file%s.file", buf);
  |  ^~
macro.c:1074:11: note: destination object referenced by 'restrict'-qualified 
argument 1 was declared here
 1074 | char *buf = NULL;
  |   ^~~

This was fixed in the codebase quite some time ago, please rebase the tree to 
get past that (obviously unrelated) issue.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-602537580___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-03-22 Thread Gordon Messmer
@gordonmessmer pushed 1 commit.

2d103575f57baca8e8d08dd032a4b2054b7fcb25  scripts/pythondistdeps: Improved 
python version and operator handling.


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015/files/12100cc343050ab69048796156bcc46d6fcdde97..2d103575f57baca8e8d08dd032a4b2054b7fcb25
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-02-01 Thread Gordon Messmer
gordonmessmer commented on this pull request.



> +else:
+rpm_epoch = ''
+while self.version[-1] == 0:
+self.version.pop()
+rpm_version = '.'.join(str(x) for x in self.version)
+if self.pre:
+rpm_suffix = '~%s' % ''.join(str(x) for x in self.pre)
+elif self.post:
+rpm_suffix = '^post%d' % self.post[1]
+else:
+rpm_suffix = ''
+return '%s%s%s' % (rpm_epoch, rpm_version, rpm_suffix)
+
+def convert_compatible(name, operator, version_id):
+if version_id.endswith('.*'):
+return 'Invalid version'

I've pushed a new commit.  The script now exits in these cases.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#discussion_r373809611___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-02-01 Thread Gordon Messmer
@gordonmessmer pushed 1 commit.

12100cc343050ab69048796156bcc46d6fcdde97  scripts/pythondistdeps: Improved 
python version and operator handling.


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015/files/5ac21460505a4c4789152a17ab51112b61ddcc9f..12100cc343050ab69048796156bcc46d6fcdde97
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-01-31 Thread Gordon Messmer
gordonmessmer commented on this pull request.



> +version_id = version_id[:-2]
+version = RpmVersion(version_id)
+lower_version = RpmVersion(version_id).increment()
+else:
+version = RpmVersion(version_id)
+lower_version = version
+return '(%s < %s or %s > %s)' % (
+name, version, name, lower_version)
+
+def convert_ordered(name, operator, version_id):
+if version_id.endswith('.*'):
+version_id = version_id[:-2]
+version = RpmVersion(version_id)
+if '>' == operator:
+operator = '>='
+version.increment()

It's not intentional, and undefined.  I think this interpretation/conversion is 
fine, though.

https://mail.python.org/archives/list/distutils-...@python.org/thread/NWEQVTCX5CR2RKW2LT4H77PJTEINSX7P/

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#discussion_r373640098___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-01-27 Thread Gordon Messmer
gordonmessmer commented on this pull request.



> +version_id = version_id[:-2]
+version = RpmVersion(version_id)
+lower_version = RpmVersion(version_id).increment()
+else:
+version = RpmVersion(version_id)
+lower_version = version
+return '(%s < %s or %s > %s)' % (
+name, version, name, lower_version)
+
+def convert_ordered(name, operator, version_id):
+if version_id.endswith('.*'):
+version_id = version_id[:-2]
+version = RpmVersion(version_id)
+if '>' == operator:
+operator = '>='
+version.increment()

I'm checking with the distutils-sig.  The current behavior of "> version.*" is 
equivalent to ">= version", which seems like it might not be intentional.

```
>>> pkg_resources._vendor.packaging.requirements.Requirement('cairocffi > 
>>> 1.0.*,< 1.0.1').specifier._specs
frozenset({1.0.*')>, })

>>> '1.7' in pkg_resources.Requirement.parse('foo>1.7.*')
True
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#discussion_r371621087___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-01-22 Thread Gordon Messmer
gordonmessmer commented on this pull request.



> +version_id = version_id[:-2]
+version = RpmVersion(version_id)
+lower_version = RpmVersion(version_id).increment()
+else:
+version = RpmVersion(version_id)
+lower_version = version
+return '(%s < %s or %s > %s)' % (
+name, version, name, lower_version)
+
+def convert_ordered(name, operator, version_id):
+if version_id.endswith('.*'):
+version_id = version_id[:-2]
+version = RpmVersion(version_id)
+if '>' == operator:
+operator = '>='
+version.increment()

This is in the case that the version ends with `.*`.  Assuming that you mean `> 
2.5.*`, yes, that would be converted to `>= 2.6`.  I want to look at the spec 
again, because I no longer remember on what I based that conversion and it 
seems wrong.  pip seems happy with 1.0.0 matching 1>1.0.*`

```
$ pip install 'cairocffi > 1.0.*,< 1.0.1'
Collecting cairocffi<1.0.1,>1.0.*
  Downloading 
https://files.pythonhosted.org/packages/8e/05/143647cb9c228122264a70f82543bbc9cc499b4078c242a24b6b546e2050/cairocffi-1.0.0-py3-none-any.whl
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#discussion_r369621121___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-01-22 Thread Gordon Messmer
gordonmessmer commented on this pull request.



> +else:
+rpm_epoch = ''
+while self.version[-1] == 0:
+self.version.pop()
+rpm_version = '.'.join(str(x) for x in self.version)
+if self.pre:
+rpm_suffix = '~%s' % ''.join(str(x) for x in self.pre)
+elif self.post:
+rpm_suffix = '^post%d' % self.post[1]
+else:
+rpm_suffix = ''
+return '%s%s%s' % (rpm_epoch, rpm_version, rpm_suffix)
+
+def convert_compatible(name, operator, version_id):
+if version_id.endswith('.*'):
+return 'Invalid version'

The expression is invalid, and will cause setup.py to fail, so I'm reasonably 
certain that we'd never see it, but exiting with an error code is probably a 
good idea anyway.

(rpm would otherwise require a package named "Invalid version")

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#discussion_r369608817___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-01-22 Thread Miro Hrončok
hroncok commented on this pull request.



> +version_id = version_id[:-2]
+version = RpmVersion(version_id)
+lower_version = RpmVersion(version_id).increment()
+else:
+version = RpmVersion(version_id)
+lower_version = version
+return '(%s < %s or %s > %s)' % (
+name, version, name, lower_version)
+
+def convert_ordered(name, operator, version_id):
+if version_id.endswith('.*'):
+version_id = version_id[:-2]
+version = RpmVersion(version_id)
+if '>' == operator:
+operator = '>='
+version.increment()

Does this mean that `> 2.5` is converted to `>= 2.6`? Is that how Python 
versions work, i.e. `> 2.5` means `2.5.1` is not good? (That actually makes 
sense, just making sure.)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#pullrequestreview-346448262___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-01-22 Thread Miro Hrončok
hroncok commented on this pull request.



> +else:
+rpm_epoch = ''
+while self.version[-1] == 0:
+self.version.pop()
+rpm_version = '.'.join(str(x) for x in self.version)
+if self.pre:
+rpm_suffix = '~%s' % ''.join(str(x) for x in self.pre)
+elif self.post:
+rpm_suffix = '^post%d' % self.post[1]
+else:
+rpm_suffix = ''
+return '%s%s%s' % (rpm_epoch, rpm_version, rpm_suffix)
+
+def convert_compatible(name, operator, version_id):
+if version_id.endswith('.*'):
+return 'Invalid version'

What does RPM say in this case? Does it fail the build saying version cannot 
have spaces? Should this script exit with 1 instead, with a meaningful error 
message?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#pullrequestreview-346445936___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Improved python version and operator handling. (#1015)

2020-01-22 Thread Miro Hrončok
Thank you @gordonmessmer! I'll check out the code, but the results look 
promising.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1015#issuecomment-577084086___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint