@@ 1558-1588 (lines=31) @@ | ||
1555 | write_to_version_file(target_versionfile, versions) |
|
1556 | cmds["build_py"] = cmd_build_py |
|
1557 | ||
1558 | if "cx_Freeze" in sys.modules: # cx_freeze enabled? |
|
1559 | from cx_Freeze.dist import build_exe as _build_exe |
|
1560 | # nczeczulin reports that py2exe won't like the pep440-style string |
|
1561 | # as FILEVERSION, but it can be used for PRODUCTVERSION, e.g. |
|
1562 | # setup(console=[{ |
|
1563 | # "version": versioneer.get_version().split("+", 1)[0], # FILEVERSION |
|
1564 | # "product_version": versioneer.get_version(), |
|
1565 | # ... |
|
1566 | ||
1567 | class cmd_build_exe(_build_exe): |
|
1568 | def run(self): |
|
1569 | root = get_root() |
|
1570 | cfg = get_config_from_root(root) |
|
1571 | versions = get_versions() |
|
1572 | target_versionfile = cfg.versionfile_source |
|
1573 | print("UPDATING %s" % target_versionfile) |
|
1574 | write_to_version_file(target_versionfile, versions) |
|
1575 | ||
1576 | _build_exe.run(self) |
|
1577 | os.unlink(target_versionfile) |
|
1578 | with open(cfg.versionfile_source, "w") as f: |
|
1579 | LONG = LONG_VERSION_PY[cfg.VCS] |
|
1580 | f.write(LONG % |
|
1581 | {"DOLLAR": "$", |
|
1582 | "STYLE": cfg.style, |
|
1583 | "TAG_PREFIX": cfg.tag_prefix, |
|
1584 | "PARENTDIR_PREFIX": cfg.parentdir_prefix, |
|
1585 | "VERSIONFILE_SOURCE": cfg.versionfile_source, |
|
1586 | }) |
|
1587 | cmds["build_exe"] = cmd_build_exe |
|
1588 | del cmds["build_py"] |
|
1589 | ||
1590 | if 'py2exe' in sys.modules: # py2exe enabled? |
|
1591 | try: |
|
@@ 1590-1616 (lines=27) @@ | ||
1587 | cmds["build_exe"] = cmd_build_exe |
|
1588 | del cmds["build_py"] |
|
1589 | ||
1590 | if 'py2exe' in sys.modules: # py2exe enabled? |
|
1591 | try: |
|
1592 | from py2exe.distutils_buildexe import py2exe as _py2exe # py3 |
|
1593 | except ImportError: |
|
1594 | from py2exe.build_exe import py2exe as _py2exe # py2 |
|
1595 | ||
1596 | class cmd_py2exe(_py2exe): |
|
1597 | def run(self): |
|
1598 | root = get_root() |
|
1599 | cfg = get_config_from_root(root) |
|
1600 | versions = get_versions() |
|
1601 | target_versionfile = cfg.versionfile_source |
|
1602 | print("UPDATING %s" % target_versionfile) |
|
1603 | write_to_version_file(target_versionfile, versions) |
|
1604 | ||
1605 | _py2exe.run(self) |
|
1606 | os.unlink(target_versionfile) |
|
1607 | with open(cfg.versionfile_source, "w") as f: |
|
1608 | LONG = LONG_VERSION_PY[cfg.VCS] |
|
1609 | f.write(LONG % |
|
1610 | {"DOLLAR": "$", |
|
1611 | "STYLE": cfg.style, |
|
1612 | "TAG_PREFIX": cfg.tag_prefix, |
|
1613 | "PARENTDIR_PREFIX": cfg.parentdir_prefix, |
|
1614 | "VERSIONFILE_SOURCE": cfg.versionfile_source, |
|
1615 | }) |
|
1616 | cmds["py2exe"] = cmd_py2exe |
|
1617 | ||
1618 | # we override different "sdist" commands for both environments |
|
1619 | if "setuptools" in sys.modules: |