#81 Put rust2rpm version in header, say we support python3.8, and some other minor updates
Merged 3 years ago by ignatenkobrain. Opened 3 years ago by zbyszek.
fedora-rust/ zbyszek/rust2rpm versions-and-classifiers  into  master

file modified
+2
@@ -1,2 +1,4 @@ 

  from .metadata import *

  from . import licensing

+ 

+ __version__ = '9'

Can't we get this from the setuptools data instead of hardcoding it?

file modified
+7 -3
@@ -17,7 +17,7 @@ 

  import requests

  import tqdm

  

- from . import Metadata, licensing

+ from . import Metadata, licensing, __version__

  from .metadata import normalize_deps

  

  DEFAULT_EDITOR = "vi"
@@ -34,8 +34,11 @@ 

      lstrip_blocks=True)

  

  def get_default_target():

-     # TODO: add fallback for /usr/lib/os-release

-     with open("/etc/os-release") as os_release_file:

+     try:

+         os_release_file = open('/etc/os-release')

+     except FileNotFoundError:

+         os_release_file = open('/usr/lib/os-release')

+     with os_release_file:

          conf = configparser.ConfigParser()

          conf.read_file(itertools.chain(["[os-release]"], os_release_file))

          os_release = conf["os-release"]
@@ -262,6 +265,7 @@ 

          patch_file = None

  

      kwargs = {}

+     kwargs["generator_version"] = __version__

      kwargs["crate"] = crate

      kwargs["target"] = args.target

      kwargs["all_features"] = args.all_features

file modified
+1 -1
@@ -1,5 +1,5 @@ 

  {% include target ~ "-header.spec.inc" ignore missing %}

- # Generated by rust2rpm

+ # Generated by rust2rpm {{ generator_version }}

  %bcond_without check

  {% if not include_main %}

  %global debug_package %{nil}

file modified
+12 -2
@@ -1,8 +1,17 @@ 

  from setuptools import setup

  

+ def read_version(path):

+     with open(path, 'rt') as f:

+         for line in f:

+             if line.startswith('__version__'):

+                 return line.split("'")[1]

+         raise IOError

+ 

+ version = read_version('rust2rpm/__init__.py')

+ 

  ARGS = dict(

      name="rust2rpm",

-     version="9",

+     version=version,

      description="Convert Rust crates to RPM",

      license="MIT",

      keywords="rust cargo rpm",
@@ -35,13 +44,14 @@ 

      author_email="ignatenkobrain@fedoraproject.org",

      url="https://pagure.io/fedora-rust/rust2rpm",

      classifiers=[

-         "Development Status :: 3 - Alpha",

+         "Development Status :: 4 - Beta",

          "Intended Audience :: Developers",

          "License :: OSI Approved :: MIT License",

          "Operating System :: POSIX :: Linux",

          "Programming Language :: Python :: 3 :: Only",

          "Programming Language :: Python :: 3.6",

          "Programming Language :: Python :: 3.7",

+         "Programming Language :: Python :: 3.8",

          "Topic :: Software Development :: Build Tools",

          "Topic :: System :: Software Distribution",

          "Topic :: Utilities",

no initial comment

Can't we get this from the setuptools data instead of hardcoding it?

@zbyszek I was thinking if we should use setuptools_scm for this. Although it looks good.

Can't we get this from the setuptools data instead of hardcoding it?

It's not hardcoding, because it has to be defined somewhere, and this patch just moves the definition from one place to another.

setuptools_scm

I guess that's an option but I'd prefer to go with my version. If somebody wants to convert it later, they can do so in a separate PR. I'm not a big fun of setuptools myself.

rebased onto aa9fc86

3 years ago

Pull-Request has been merged by ignatenkobrain

3 years ago