| 173 | |
| 174 | def _conda_format(req): |
| 175 | def _sub(m): |
| 176 | name = m.group('name').lower() |
| 177 | if name == 'numpy': |
| 178 | return 'numpy x.x' |
| 179 | if name == 'tables': |
| 180 | name = 'pytables' |
| 181 | |
| 182 | comp, spec = m.group('comp', 'spec') |
| 183 | if comp and spec: |
| 184 | formatted = '%s %s%s' % (name, comp, spec) |
| 185 | else: |
| 186 | formatted = name |
| 187 | pycomp, pyspec = m.group('pycomp', 'pyspec') |
| 188 | if pyspec: |
| 189 | # Compare the two-digit string versions as ints. |
| 190 | selector = ' # [int(py) %s int(%s)]' % ( |
| 191 | pycomp, ''.join(pyspec.split('.')[:2]).ljust(2, '0') |
| 192 | ) |
| 193 | return formatted + selector |
| 194 | |
| 195 | return formatted |
| 196 | |
| 197 | return REQ_PATTERN.sub(_sub, req, 1) |
| 198 | |