Commit Graph

284 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
e6f91a13e7 misc: replace domain of mercurial ML address by mercurial-scm.org
This patch also adds new check-code.py pattern to detect invalid usage
of "mercurial@selenic.com".

Change for test-convert-tla.t is tested, but similar change for almost
same test-convert-baz.t isn't yet tested actually, because I couldn't
find out the way to get "GNU Arch baz client".

AFAIK, buildbot skips test-convert-baz.t, too. Does anybody have
appropriate environment for testing?
2017-02-11 00:23:53 +09:00
Gregory Szorc
e72b99afbe setup: pass named argument to setup_zstd
The next release from upstream adds another named argument to this
function. Specify arguments by name so there is no ambiguity about
which argument is being passed.
2017-01-04 19:17:44 -08:00
Gábor Stefanik
0ee701a6a4 setup: include a dummy $PATH in the custom environment used by build.py
This is required for building with pypiwin32, the pip-installable replacement
for pywin32.
2016-10-28 17:44:28 +02:00
Gregory Szorc
41b3cb270e setup: add flag to build_ext to control building zstd
Downstream packagers will inevitably want to disable building the
vendored python-zstandard Python package. Rather than force them
to patch setup.py, let's give them a knob to use.

distutils Command classes support defining custom options. It requires
setting certain class attributes (yes, class attributes: instance
attributes don't work because the class type is consulted before it
is instantiated).

We already have a custom child class of build_ext, so we set these
class attributes, implement some scaffolding, and override
build_extensions to filter the Extension instance for the zstd
extension if the `--no-zstd` argument is specified.

Example usage:

  $ python setup.py build_ext --no-zstd
2016-11-17 20:09:10 -08:00
Gregory Szorc
c746a321ba setup: compile zstd C extension
Now that zstd and python-zstandard are vendored, we can start compiling
them as part of the install.

python-zstandard provides a self-contained Python function that returns
a distutils.extension.Extension, so it is really easy to add zstd
to our setup.py without having to worry about defining source files,
include paths, etc. The function even allows specifying the module
name the extension should be compiled as. This conveniently allows us
to compile the module into the "mercurial" package so "our" version
won't collide with a version installed under the canonical "zstd"
module name.
2016-11-10 22:26:35 -08:00
Jun Wu
4df846b1cb setup: test setproctitle before building osutil
We are going to use setproctitle (provided by FreeBSD) if it's available in
the next patch. Therefore provide a macro to give some clues to the C
pre-processor so it could choose code path wisely.
2016-11-11 20:45:40 +00:00
Jun Wu
13e79c95ee setup: move cffi stuff to mercurial/cffi
This patch moves all setup*cffi stuff to mercurial/cffi to make the root
directory cleaner. The idea was from mpm [1]:

  > It seems like we could have a fair amount of cffi definitions, and
  > cluttering the root directory (or mercurial/) with them is probably not
  > a great long-term solution. We could probably add a cffi/ directory
  > under mercurial/ to parallel pure/.

[1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-July/086442.html
2016-11-09 22:08:30 +00:00
Maciej Fijalkowski
a33764dd71 bdiff: implement cffi version of blocks 2016-07-28 14:17:08 +02:00
Maciej Fijalkowski
c98b11e3dd mpatch: write a cffi version of mpatch.patches 2016-07-25 15:10:52 +02:00
Maciej Fijalkowski
3bdeeb5959 mpatch: split mpatch into two files 2016-07-18 19:02:30 +02:00
Maciej Fijalkowski
b0e2d543a3 osutil: add darwin-only version of os.listdir using cffi 2016-07-11 11:05:08 +02:00
Maciej Fijalkowski
04dfc79402 bdiff: split bdiff into cpy-aware and cpy-agnostic part 2016-07-13 10:46:26 +02:00
Maciej Fijalkowski
b3d62e8a18 setup: prepare for future cffi modules by adding placeholder in setup 2016-07-11 10:44:18 +02:00
Maciej Fijalkowski
8e7a874bdf internals: move the bitmanipulation routines into its own file
This is to allow more flexibility with the C sources -- now the
bitmanipulation routines can be safely imported without importing Python.h
2016-06-06 13:08:13 +02:00
Gregory Szorc
ec5e1b8364 setup: detect Python DLL filename from loaded DLL
Attempting to build Mercurial from source using MinGW from
msys2 on Windows produces a hg.exe that attempts to load e.g.
python27.dll. MinGW prefixes its library name with "lib" and
adds a period between the major and minor versions. e.g.
"libpython2.7.dll."

Before this patch, hg.exe files in a MinGW environment would
either fail to find a Python DLL or would attempt to load a
non-MinGW DLL, which would summarily explode. Either way,
hg.exe wouldn't work.

This patch improves the code that determines the Python DLL
filename to actually use the loaded Python DLL instead of
inferring it. Basically we take the handle of the loaded DLL
from sys.dllhandle and call a Windows API to try to resolve
that handle to a filename.
2016-04-28 08:52:13 -07:00
Sean Farley
37b99cd842 setup: add missing hgext.fsmonitor
Before this patch, fsmonitor was not installed along with other extensions. It
did correctly build the C files needed but forgot to copy over the python
files. This patch fixes it by adding fsmonitor and fsmonitor.pywatchman to the
correct install variable.
2016-03-22 16:08:02 -07:00
Sean Farley
93032eb960 setup: alphabetize hgext packages 2016-03-22 16:05:22 -07:00
Pierre-Yves David
5d3d0e1d77 extensions: also search for extension in the 'hgext3rd' package
Mercurial extensions are not meant to be normal python package/module. Yet the
lack of an official location to install them means that a lot of them actually
install as root level python package, polluting the global Python package
namespace and risking collision with more legit packages. As we recently
discovered, core python actually support namespace package. A way for multiples
distinct "distribution" to share a common top level package without fear of
installation headache. (Namespace package allow submodule installed in different
location (of the 'sys.path') to be imported properly. So we are fine as long as
extension includes a proper 'hgext3rd.__init__.py' to declare the namespace
package.)

Therefore we introduce a 'hgext3rd' namespace packages and search for extension
in it. We'll then recommend third extensions to install themselves in it.
Strictly speaking we could just get third party extensions to install in 'hgext'
as it is also a namespace package. However, this would make the integration of
formerly third party extensions in the main distribution more complicated as the third
party install would overwrite the file from the main install. Moreover, having an
explicit split between third party and core extensions seems like a good idea.

The name 'hgext3rd' have been picked because it is short and seems explicit enough.
Other alternative I could think of where:

- hgextcontrib
- hgextother
- hgextunofficial
2016-03-11 10:30:08 +00:00
Martijn Pieters
64a4b2e8cf fsmonitor: dependencies for new experimental extension
In preparation for the filesystem monitor extension, include the pywatchman
library. The fbmonitor extension relies on this library to communicate with
the Watchman service. The library is BSD licensed and is taken from
https://github.com/facebook/watchman/tree/master/python.

This package has not been updated to mercurial code standards.
2016-03-02 16:25:12 +00:00
timeless
b4b94546a3 setup: show how to set the module policy for imports
This is not technically needed, since mercurial.__version__
does not exist as a native module, but, without this style wrappings,
if something else had a native flavor, the module loader would get
upset.

In principle, the `env` object is trying to set HGMODULEPOLICY for
children, so, conceptually we should set it for this in-process
child.
2016-01-12 04:45:29 +00:00
timeless
d54666f50a setup: create a module for the modulepolicy
Instead of rewriting __init__ to define the modulepolicy,
write out a __modulepolicy__.py file like __version__.py

This should work for both system-wide installation and in-place build. Therefore
we can avoid relying on two separate modulepolicy rules, '@MODULELOADPOLICY@'
and 'mercurial/modulepolicy'.
2016-03-09 15:47:01 +00:00
timeless
8236c6ab8f setup: switch to with open as
We're leaving the modulepolicy bit alone, because it's being
rewritten in the next commit.
2016-03-09 15:35:57 +00:00
Gregory Szorc
0a19894b15 setup: remove support for 2to3
We want to run unaltered source on multiple Python versions. We
won't be using 2to3 for Python 3 support.
2016-02-27 21:11:24 -08:00
FUJIWARA Katsunori
bf3b0554e8 setup: avoid procedure related to hg.exe at setup.py --pure
Before this patch, "setup.py --pure" fails on Windows, because
hgbuildscripts.run() tries to copy "hg.exe", which doesn't generated
at "setup.py --pure".

At that time, run_command('build_hgexe') invoked in
hgbuildscripts.run() does nothing and returns successfully. Therefore,
subsequent procedure assuming existence of "hg.exe" fails.

This patch avoids procedure related to "hg.exe" (= all of
hgbuildscripts.run() except for build_scripts.run() invocation) at
"setup.py --pure".
2016-02-08 21:12:13 +09:00
timeless
7c2842e773 copyright: update to 2016 2016-01-21 21:15:52 +00:00
timeless
ebb1d48658 cleanup: remove superfluous space after space after equals (python) 2015-12-31 08:16:59 +00:00
Gregory Szorc
86d5fa7b54 setup.py: package internals help files
mpm says internal docs should be visible via `hg help` and hgweb. They
need to be in the distribution for this to work. Package them.
2015-12-13 11:34:04 -08:00
Gregory Szorc
0ef02c44e6 setup.py: use bytes literals
The b() helper was needed because Python < 2.6 didn't support bytes
literals (b''). Now that we don't support Python < 2.6, we no longer
need this helper.
2015-12-13 09:40:53 -08:00
Gregory Szorc
c2ce8b2cf6 setup.py: don't rewrite @LIBDIR@ when creating wheels
This is necessary to produce wheels that install properly. More
details are captured in an in-line comment.

After this patch, produced wheels can be installed via `pip install`
and appear to "just work," including on Windows.
2015-12-05 17:52:50 -08:00
Gregory Szorc
71b0bcdfe0 setup.py: attempt to build and install hg.exe on Windows
Currently, packaging Mercurial on Windows will produce a
Scripts\hg Python script and a Scripts\hg.bat batch script. The
py2exe distribution contains a hg.exe which loads a Python
interpretter and invokes the "hg" Python script. Running a
exe directly has benefits over batch scripts because batch
scripts do things like muck around with command arguments.

This patch implements a custom "build_scripts" command which
attempts to build hg.exe on Windows. If hg.exe is built, it is
marked as a "script" file and installed into the Scripts\
directory on Windows. Since hg.exe is redundant and better than
hg.bat, if hg.exe is built, hg.bat is not installed.

Since some environments don't support compiling C programs,
we treat hg.exe as optional and catch failures building it. This
is not ideal. However, I reckon most Windows users will not be
installing Mercurial from source: they will get it from the MSI
installer or via `pip install Mercurial`, which will download a
wheel that has hg.exe in it. So, I don't think this is a big deal.
2015-12-04 00:24:48 -08:00
Gregory Szorc
a150316d11 setup: refactor handling of modules with C/Python implementations
Previously, .py files under mercurial/pure/ were copied to mercurial/*
during installation if we were performing a pure Python installation.

Now that the new import hooks and module load policy are in place, this
hackery from the past is no longer necessary.

With this patch, we stop copying modules from mercurial/pure/* to
mercurial/*. Instead, we preserve the files at their original
hierarchy, mirroring the source repository structure.

In addition, we always install the pure modules. Before, we would only
include the pure modules in the distribution/installation if the
install-time settings requested a pure Python installation. The upside
of this change is that CPython and PyPy can run from the same Mercurial
installation, making packaging and distribution of Mercurial simpler.

The inclusion of pure Python modules in the installation sounds
risky, as it could lead to inadvertent loading of non-C modules.
This shouldn't be a problem. The default module load policy is "C
only" (or at least will be shortly) and the only way to load pure
modules from an installation is if a) pure installation was requested
b) the HGMODULELOADPOLICY overrides the requirement for C modules.

The default module load policy as defined in source is a special string
whose default value from the checkout is equivalent to the "C only"
policy (again, not exactly the state right now). For pure
installations, this default policy is not appropriate and will not
work. This patch adds support for rewriting __init__.py during
installation to reflect the module load policy that should be in
place accoding to the installation settings. For default CPython
installs, the value in the source file will change but there will
be no functional change. For pure installations, the default policy
will be set to "py," allowing them to work without having to set
environment variables.
2015-12-03 21:48:12 -08:00
Gregory Szorc
d7669a769a mercurial: implement import hook for handling C/Python modules
There are a handful of modules that have both pure Python and C
extension implementations. Currently, setup.py copies files from
mercurial/pure/*.py to mercurial/ during the install process if C
extensions are not available. This way, "import mercurial.X" will
work whether C extensions are available or not.

This approach has a few drawbacks. First, there aren't run-time checks
verifying the C extensions are loaded when they should be. This could
lead to accidental use of the slower pure Python modules. Second, the
C extensions aren't compatible with PyPy and running Mercurial with
PyPy requires installing Mercurial - you can't run ./hg from a source
checkout. This makes developing while running PyPy somewhat difficult.

This patch implements a PEP-302 import hook for finding and loading the
modules with both C and Python implementations. When a module with dual
implementations is requested for import, its import is handled by our
import hook.

The importer has a mechanism that controls what types of modules we
allow to load. We call this loading behavior the "module load policy."
There are 3 settings:

* Only load C extensions
* Only load pure Python
* Try to load C and fall back to Python

An environment variable allows overriding this policy at run time. This
is mainly useful for developers and for performing actions against the
source checkout (such as installing), which require overriding the
default (strict) policy about requiring C extensions.

The default mode for now is to allow both. This isn't proper and is
technically backwards incompatible. However, it is necessary to
implement a sane patch series that doesn't break the world during
future bisections. The behavior will be corrected in future patch.

We choose the main mercurial/__init__.py module for this code out of
necessity: in a future world, if the custom module importer isn't
registered, we'll fail to find/import certain modules when running
from a pure installation. Without the magical import-time side-effects,
*any* importer of mercurial.* modules would be required to call a
function to register our importer. I'm not a fan of import time side
effects and I initially attempted to do this. However, I was foiled by
our own test harness, which has numerous `python` invoked scripts that
"import mercurial" and fail because the importer isn't registered.
Realizing this problem is probably present in random Python scripts
that have been written over the years, I decided that sacrificing
purity for backwards compatibility is necessary. Plus, if you are
programming Python, "import" should probably "just work."

It's worth noting that now that we have a custom module loader, it
would be possible to hook up demand module proxies at this level
instead of replacing __import__. We leave this work for another time,
if it's even desired.

This patch breaks importing in environments where Mercurial modules
are loaded from a zip file (such as py2exe distributions). This will
be addressed in a subsequent patch.
2015-12-03 21:37:01 -08:00
Gregory Szorc
924c306e02 setup: remove unused py_modules argument to setup()
It is never populated and is useless clutter.
2015-11-24 21:17:26 -08:00
Nathan Goldbaum
d769f6e8d5 setup: import setup from setuptools if FORCE_SETUPTOOLS is set
This should allow easier experimentation with using setuptools in mercurial's
build automation, without breaking anything that currently depends on distutils
behavior
2015-10-09 12:25:51 -05:00
Matt Mackall
5e1b4ad958 urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
Steve Borho
a761baa73e wix: move library.zip and all *.pyd into a lib/ folder
This makes the root install folder (on Windows) nice and tidy. The
only files left in the root folder are:

hg.exe
python27.dll
COPYING.rtf
ReadMe.html

the last of which was probably out-of-date 7 years ago
2015-06-03 14:31:19 -05:00
Matt Mackall
299dec1a96 setup: use try/except/finally
This will raise a syntax error for people who attempt to use Py2.4,
but that's already going to fail and we have no way to keep other
2.6isms from creeping in since we've removed the check-code rules and
the buildbot.
2015-05-15 10:00:46 -05:00
Adrian Buehlmann
45d3a8d1b2 setup: integrate osutil C extension into extmodules initialization 2015-05-14 11:04:36 +02:00
Adrian Buehlmann
002e78a3a2 setup: move osutil_ldflags logic to before extmodules definition 2015-05-14 11:04:35 +02:00
Adrian Buehlmann
18518a526f setup: kill pure hack for osutil on Windows for Python 2.4
see fdf2b87f38d5
2015-05-14 11:04:31 +02:00
Augie Fackler
ecb14ee3ba setup: decode xcode version number on python3 2015-04-12 16:13:38 -04:00
Pierre-Yves David
6077e8adb2 setup.py: drop compatibility with Python 2.4 and 2.5 (BC)
The last blocker for dropping Python 2.4 was Centos 5. We now provide our own
Mercurial package for Centos 5 with a bundled Python2.7.

I'm therefore happy to officially drop compatibility with Python 2.4 (and
Python 2.5 that nobody really cares about). This open the season for code
cleanup.

It is war's prize to take all vantage.
2015-05-08 23:44:15 -07:00
Augie Fackler
a9418602a5 setup: hide octal literals inside strings so they're portable (issue4554) 2015-04-12 15:36:10 -04:00
Augie Fackler
b619fe8004 manifest.c: new extension code to lazily parse manifests
This lets us iterate manifests in order, but do a _lot_ less work in
the common case when we only care about a few manifest entries.

Many thanks to Mike Edgar for reviewing this in advance of it going
out to the list, which caught many things I missed.

This version of the patch includes C89 fixes from Sean Farley and
many correctness/efficiency cleanups from Martin von
Zweigbergk. Thanks to both!
2015-01-13 14:31:38 -08:00
Joan Massich
b9e096fd36 setup.py: do not install c extensions on pypy
These extensions are slower on pypy because pypy has a JIT compiler.
And also, they often do not compile (it depends on the pypy configuration).
2015-02-22 15:40:36 +01:00
Jesus Cea
60d6ae885a copyright: update to 2015
Many files and translations have an outdated copyright date.
Change that to the correct "2005-2015" dates.
2015-03-02 14:52:04 +01:00
Ludovic Chabant
8128d9e633 setup: don't fail when Python doesn't have the cygwinccompiler package
Some Python installations like the ones available from the optware
project
for the Synology DiskStation NASes don't have that package, which means
running the setup script will crash and exit right away. Instead, we now
just use an empty/fake class for the HackedMingw32CCompiler, which we
likely won't use anyway.
2014-12-23 19:54:48 -08:00
Siddharth Agarwal
0615fc4a49 setup: use changes since latest tag instead of just distance
For a Mercurial built on the merge from stable into default right after 3.2.2
was released -- fa2ec68252fb -- the version number produced was "3.2.2+4". This
is potentially misleading, since in reality the built Mercurial includes many
more changes compared to 3.2.2.

Change the versioning scheme so that we take into consideration all the changes
present in the current revision that aren't present in the latest tag. For
fa2ec68252fb the new versioning scheme results in a version number of
"3.2.2+256". This gives users a much better idea of how many changes have
actually happened since the latest release.

Since changessincelatesttag is always greater than or equal to the
latesttagdistance, this will produce version numbers that are always greater
than or equal to the old scheme. Thus there's minimal compatibility risk.
2014-12-12 15:31:28 -08:00
Siddharth Agarwal
1ea8dd0663 setup: use changessincelatesttag from archive if present
changessincelatesttag gives one a better idea of how much the code has changed
since. Since changessincelatesttag is always greater than or equal to the
latesttagdistance (see previous patch for why), this will always produce
version numbers greater than or equal to the previous scheme.
2014-12-12 15:29:39 -08:00
Jeff Sickel
5a403fa38d plan9: setup check for current python build 2014-11-25 02:27:31 -06:00
Mads Kiilerich
7f5af5ba4c config: introduce "built-in" default configuration settings in default.d
This helps providing a more consistent user experience on all platforms and
with all packaging.

The exact location of default.d depends on how Mercurial is installed and
whether it is 'frozen'. The exact location should never be relevant to users
and is intentionally not explained in details in the documentation. It will
however always be next to the help and templates files.

Note that setting HGRCPATH also disables these defaults. I don't know if that
should be considered a bug or a feature.
2014-09-04 21:36:35 +02:00
Kyle Lippincott
15ea39170d setup: set mode 644 or 755 on installed files 2014-09-30 17:13:54 -07:00
Mads Kiilerich
69f5c2ecc6 ssl: on OS X, use a dummy cert to trick Python/OpenSSL to use system CA certs
This will give PKI-secure behaviour out of the box, without any configuration.

Setting web.cacerts to any value or empty will disable this trick.

This dummy cert trick only works on OS X 10.6+, but 10.5 had Python 2.5 which
didn't have certificate validation at all.
2014-09-26 02:19:48 +02:00
Mads Kiilerich
03327f4889 osx: create dmg with installer instead of zip
OS X would offer to expand the zip so the (multi file) installer inside it
could be run ... but that would leave the expanded zip folder around.

Instead, use a .dmg file that automatically will be mounted - that seems more
common on OS X.

Still, there is two levels of levels of clicking before actually launching the
installer. Having a single file installer would be better ... but seems to be
hard. A more feasible improvement would be some fancy layout inside the .dmg .
2014-08-31 10:24:25 +02:00
Mads Kiilerich
5d1360e0ed cleanup: make sure we always access members of imported modules
This will make sure we get import errors, even if demandimport is enabled.

This will also mute some pyflakes 'imported but unused' warnings.
2014-08-15 04:37:45 +02:00
Augie Fackler
ea755c45b4 Merge with stable. 2014-07-06 15:39:01 -04:00
Alex Gaynor
f93b638918 setup: fixed for Pythons which don't have a CFLAGS
Specifically this is observed to happen on the PyPy one gets from homebrew
2014-07-05 07:31:08 -07:00
Thomas Arendsen Hein
aedd3b060c setup.py, make: avoid problems with outdated, existing hgext/__index__.py*
"make clean" already removed __index__.py[cdo], but not the __index__.py
(automatically generated by "python setup.py build_hgextindex").

"setup.py build_hgextindex" did not generate a new index if file
__index__.py[cdo] already existed, because if __index__.py was removed,
the compiled file containing the old information was imported and used.
Generate an empty file (with a new timestamp to generate a new .py[cdo])
instead and make mercurial.extensions ignore the unset docs attribute.

One of the problems was a failed test-help.t, to reproduce:

$ rm hgext/__index__.py*
$ echo 'docs = {"mq": "dummy"}' > hgext/__index__.py
$ make test-help.t

With this a "make clean" or "python setup.py build_hgextindex" helps.
2014-05-05 16:54:15 +02:00
Matt Mackall
4e8380a6a4 setup: make Xcode 5.1 check less specific
Was failing on "5.1\n".
2014-05-27 10:31:59 -07:00
Kent Frazier
ddcb0f363a setup.py: fix C extension compilation issue with OS X 10.9 and Xcode 5.1 2014-04-15 16:27:12 -04:00
Augie Fackler
2029c18034 setup.py: fix 2.4 breakage in 77ab0abb 2014-03-12 18:28:57 -04:00
Augie Fackler
6e7749ad7e setup: handle more invalid python3 syntax
This should keep the file portable to both python2 and python3.
2013-09-19 15:38:42 -04:00
Augie Fackler
428555deb5 setup.py: move from dict() construction to {} literals
The latter are both faster and more consistent across Python 2 and 3.
2014-03-12 13:29:29 -04:00
Matt Mackall
eb09e501b5 tests: fix unused imports from inotify removal caught by pyflakes 2014-03-04 09:56:59 -06:00
Matt Mackall
66c8bd54e8 extensions: remove the inotify extension (BC)
This extension has always had correctness issues and has been
unmaintained for years. It is now removed in favor of the third-party
hgwatchman which is maintained and appears to be correct.

Users with inotify enabled in their config files will fall back to
standard status performance.
2014-03-01 16:20:15 -06:00
Wei, Elson
2a24db69d7 setup: check if mercurial/util.h has been modified
Before, if mercurial/util.h was modified but *.c wasn't, no extension
was rebuilt.
2013-09-13 10:00:57 +08:00
Mads Kiilerich
af3a71e28b setup: make error message for missing Python headers more helpful 2013-04-12 16:55:34 -04:00
Bryan O'Sullivan
8f78d582d5 scmutil: rewrite dirs in C, use if available
This is over twice as fast as the Python dirs code. Upcoming changes
will nearly double its speed again.

perfdirs results for a working dir with 170,000 files:
  Python     638 msec
  C          244
2013-04-10 15:08:27 -07:00
Isaac Jurado
5c5aad9d45 setup.py: properly discard trust warning.
This modification was missing from the 4a4aff3d70bd changeset.
2013-04-02 16:03:10 +02:00
Benoit Boissinot
0d369ef57d setup.py: ignore warnings from obsolete
Fix version detection with recent hg versions.
2013-03-04 10:05:52 +01:00
Benoit Boissinot
ba8b143893 setup.py: add metadata to register package to PyPI
This allows updating PyPI with just 'setup.py register' (assuming the user is
an owner or maintainer of the PyPI package).
2013-03-04 10:13:28 +01:00
Bryan O'Sullivan
af56dbda30 setup: print subprocess stderr if there is any
I just spent 1.5 days trying to debug a failing buildbot because
setup.py was silently dropping the errors that were being printed
by in-place hg.
2012-11-13 09:55:26 -08:00
Adrian Buehlmann
d768b47592 exewrapper: adapt for legacy HackableMercurial
We give up using CPython's PythonXX.lib import libraries (and Python.h), and
now "manually" call the LoadLibrary() / GetProcAddress() Windows API's instead.

If there is a "hg-python" subdirectory (the canonical directory name for
HackableMercurial's private Python copy) next to the hg.exe, we load the
pythonXX.dll from there (feeding an absolute path to LoadLibrary) and we set
Py_SetPythonHome() to that directory, so that the Python libraries are used
from there as well.

If there is no "hg-python" subdir found next to the hg.exe, we do not feed an
absolute path to LoadLibrary. This continues to allow to find a globally
installed Python DLL, as before this change - that is, without having to edit,
delete, rename, or configure anything.

Note that the hg.exe built is still bound to a *specific* major version of the
pythonXX.dll (e.g. python27.dll). What version it is, is inferred from the
version of the python interpreter that was used when calling setup.py. For
example

  C:\python27_x86\python.exe setup.py build_hgexe -i --compiler=mingw32

builds a hg.exe (using the mingw32 tool chain) bound to (x86) Python 2.7. And

  C:\python27_x86\python.exe setup.py build_hgexe -i

builds the same using the Microsoft C compiler/linker. (Note that the Microsoft
toolchain combined with x64 CPython can be used to build an x64 hg.exe.)

setup.py is changed to write the name of the pythonlib into the generated header
file "mercurial/hgpythonlib.h", which is #included by exewrapper.c. For a Python
2.7 build, it for example contains:

  #define HGPYTHONLIB "python27"

exewrapper.c then uses HGPYTHONLIB for the name of the Python dll to load.

We don't want to track mercurial/hgpythonlib.h, so we add it to .hgignore.
2012-08-07 11:04:41 +02:00
Bryan O'Sullivan
6c7ac8b7de setup: calculate version more correctly
The old calculation code failed to properly identify revs that
weren't tagged, leaving us with a version of "unknown" most of the
time during development.
2012-10-05 13:44:52 -05:00
Adrian Buehlmann
fd6785ba1c pathencode: new C module with fast encodedir() function
Not yet used (will be enabled in a later patch).

This patch is a stripped down version of patches originally created by
Bryan O'Sullivan <bryano@fb.com>
2012-09-18 11:43:30 +02:00
Adrian Buehlmann
b303a00fae setup: fix build_hgexe for mingw32 compiler
Fixes

  python setup.py build_hgexe -i --compiler=mingw32
2012-07-25 16:50:22 +02:00
Bryan O'Sullivan
ea2526a3d4 setup: disable -mno-cygwin if building under mingw32
This gcc option has been deprecated since at least 2009 (gcc 4.4),
and it causes compilations to fail entirely with gcc 4.6.x.

Upstream distutils bug: http://bugs.python.org/issue12641
2012-07-06 20:19:55 -07:00
Adrian Buehlmann
7e44d18d42 setup: compile hg.exe
This implements a new command

  $ python setup.py build_hgexe -i

which places the hg.exe in the root of the source tree.
2012-06-29 13:10:48 +02:00
Augie Fackler
c0cf243849 httpclient: omit tests for the client since we don't run them anyway 2012-05-19 09:34:25 -05:00
Brodie Rao
a706d64a2c cleanup: replace naked excepts with except Exception: ... 2012-05-12 16:02:46 +02:00
Brodie Rao
c577fac135 cleanup: replace naked excepts with more specific ones 2012-05-12 16:02:45 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Steven Stallion
d79ff306e5 plan9: initial support for plan 9 from bell labs
This patch contains support for Plan 9 from Bell Labs. A README is
provided in contrib/plan9 which describes the port in greater detail.
A new extension is also provided named factotum which permits the
factotum(4) authentication agent to provide credentials for HTTP
repositories. This extension is also applicable to other POSIX
platforms which make use of Plan 9 from User Space (aka plan9ports).
2012-04-08 12:43:41 -07:00
Brendan Cully
19039ca025 setup.py: don't call splitlines twice on the output of xcodebuild (issue3277) 2012-03-02 10:42:12 -08:00
Greg Ward
86216402d9 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Apparently, it prints nothing at all if the user installed only the
command-line tools. In that case, don't try to parse the empty output
-- just assume they have Xcode >= 4.
2012-02-27 08:54:26 -05:00
Pascal Quantin
fe27d67b3c setup: fix py2exe generation broken by c7ccdf21c98c (issue3116)
Py2exe is patching default distutils Distribution class. This patch ensures
that the right one is taken when calling hgdist class.
2011-11-20 19:14:36 +01:00
Matt Mackall
8ff3689535 setup: backout 4c2574ae2b6b
Change wasn't compatible with Python 2.x
2011-11-17 23:01:58 -06:00
Simon Heimberg
77b258d449 setup: raise when executing with python3 without c2to3 argument 2011-11-12 02:08:01 +01:00
Simon Heimberg
302466e126 setup: support executing with python3 including 2to3
Merge the code from contrib/setup3.py in setup.
The argument for executing is marked as experimental.

Reason: The file in contrib was outdated (packages, cmdclass, ...)
2011-08-21 15:23:43 +02:00
Simon Heimberg
316a653bf9 setup: hgbuildmo inherits from Command
hgbuildmo does not need anything provided by the build class.
2011-11-01 20:13:53 +01:00
Simon Heimberg
2378dbf777 setup: make script executable with python3
Replace the incompatible print statement. Writing a warning to stderr is a good
idea anyway.
2011-11-12 02:07:55 +01:00
Simon Heimberg
203f43b760 setup: subclass build command 2011-11-01 20:13:53 +01:00
Simon Heimberg
44d04f155e setup: has_ext_modules always returns false when pure is specified
When pure is specified ext_modules is emptied in hgbuildpy.finalize_options.
Before this happens has_ext_modules returned True.
2011-11-01 20:13:52 +01:00
Simon Heimberg
50a770852b setup: subclass distribution instead of overwriting original 2011-07-23 05:57:39 +02:00
Yuya Nishihara
0a388fca31 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
The issue was partially fixed by 4576ace762a0, but there were missing
variables to run build_hgextindex.
2011-10-31 00:42:32 +09:00
Matt Mackall
36e0650c7d setup: set env global earlier (3073) 2011-10-26 12:56:27 -05:00
Na'Tosha Bard
b3b49a3b91 setup: add largefiles to list of packages 2011-10-10 17:33:17 +02:00
Nikolaj Sjujskij
7548a4a762 building: build inotify for sys.platform='linux*'
If Python interpreter was built under Linux 3.x kernel, it reports
sys.platform to be 'linux3' (it is fixed for Python 3, but not for 2.x).
This cancels building inotify extension, which was built only for 'linux2'
platform. Improved test checks if sys.platform begins with 'linux', and together
with test for kernel version to be greater than 2.6 it seems to cover all known
cases.
2011-09-20 15:21:27 +03:00
Augie Fackler
4fdf4ee021 setup.py: use getattr instead of hasdattr 2011-07-25 16:08:57 -05:00
Yuya Nishihara
64bae20381 setup: add command to generate index of extensions
It generates prebuilt index of all extensions, which will be used by
frozen exe when running 'hg help extensions'.

Now py2exe invokes this command automatically.
2011-06-04 20:11:10 +09:00