File: setup.py

package info (click to toggle)
python-versioneer 0.29-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 648 kB
  • sloc: python: 2,656; makefile: 6
file content (39 lines) | stat: -rw-r--r-- 1,371 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

import os, tempfile
from setuptools import setup
from distutils.command.build_scripts import build_scripts
import versioneer
commands = versioneer.get_cmdclass().copy()

class my_build_scripts(build_scripts):
    def run(self):
        versions = versioneer.get_versions()
        tempdir = tempfile.mkdtemp()
        generated = os.path.join(tempdir, "rundemo")
        with open(generated, "wb") as f:
            for line in open("src/rundemo-template", "rb"):
                if line.strip().decode("ascii") == "versions = None":
                    f.write(('versions = %r\n' % (versions,)).encode("ascii"))
                else:
                    f.write(line)
        self.scripts = [generated]
        rc = build_scripts.run(self)
        os.unlink(generated)
        os.rmdir(tempdir)
        return rc
commands["build_scripts"] = my_build_scripts

setup(name="demo",
      version=versioneer.get_version(),
      description="Demo",
      url="url",
      author="author",
      author_email="email",
      zip_safe=True,
      scripts=["src/dummy"], # this will be replaced by my_build_scripts
      # without py_modules= or packages=, distutils thinks this module is not
      # "pure", and will put a platform indicator in the .whl name even
      # though we call bdist_wheel with --universal.
      py_modules=["fake"],
      cmdclass=commands,
      )