Skip to content

Commit

Permalink
setup.py: run 'download' command before 'egg_info'
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Oct 16, 2018
1 parent 1bf67de commit dc1c925
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import print_function, absolute_import
from setuptools import setup, find_packages, Extension, Command
from setuptools.command.build_ext import build_ext
from setuptools.command.sdist import sdist
from setuptools.command.egg_info import egg_info
from distutils.file_util import copy_file
from distutils.dir_util import mkpath, remove_tree
from distutils import log
Expand Down Expand Up @@ -204,14 +204,17 @@ def build_extension(self, ext):
copy_file(exe_fullpath, dest_path, verbose=self.verbose, dry_run=self.dry_run)


class BundledSdist(sdist):
# ensure 'download' is run before 'sdist' so the package includes ots source
sub_commands = [("download", lambda self: True)] + sdist.sub_commands
class CustomEggInfo(egg_info):

def run(self):
# make sure the ots source is downloaded before creating sdist manifest
self.run_command("download")
egg_info.run(self)


cmdclass["download"] = Download
cmdclass["build_ext"] = ExecutableBuildExt
cmdclass["sdist"] = BundledSdist
cmdclass["egg_info"] = CustomEggInfo

ots_sanitize = Executable(
"ots.ots-sanitize", script="build.py", output_dir=os.path.join("build", "meson")
Expand Down

0 comments on commit dc1c925

Please sign in to comment.