  We study the evolution of the circumstellar medium of massive stars. We pay
particular attention to Wolf-Rayet stars that are thought to be the progenitors
of some long Gamma-Ray Bursts. We detail the mass-loss rates we use in our
stellar evolution models and how we estimate the stellar wind speeds during
different phases. With these details we simulate the interactions between the
wind and the interstellar medium to predict the circumstellar environment
around the stars at the time of core-collapse. We then investigate how the
structure of the environment might affect the GRB afterglow. We find that when
the afterglow jet encounters the free-wind to stalled-wind interface that
rebrightening occurs and a bump is seen in the afterglow light curve. However
our predicted positions of this interface are too distant from the site of the
GRB to reach while the afterglow remains observable. The values of the
final-wind density, A_{*}, from our stellar models are similar to the values
inferred from observed afterglow lightcurves and those from observed Wolf-Rayet
stars. However we do not reproduce the lowest observed A_{*} values below 0.3.
For these cases we suggest that the progenitors could have been a WO type
Wolf-Rayet star, be in a close binary or very low metallicity star. Finally we
turn our attention to the matter of stellar wind material producing absorption
lines in the afterglow spectra. We discuss the observational signatures of two
Wolf-Rayet stellar types, WC and WO, in the afterglow lightcurve and spectra.
We also indicate how it may be possible to constrain the initial mass and
metallicity of a GRB progenitor by using the inferred wind density and wind
velocity.
